pipewire: update patches
[AGL/meta-agl-devel.git] / meta-pipewire / recipes-multimedia / pipewire / pipewire / 0006-logger-print-timestamps-on-logged-messages.patch
1 From 352c58357e5922b21d664c1f5a0b89a74f864f41 Mon Sep 17 00:00:00 2001
2 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
3 Date: Wed, 3 Jul 2019 17:47:46 +0300
4 Subject: [PATCH] logger: print timestamps on logged messages
5
6 Timestamps have usec precision and the seconds are limited
7 to 9 digits. Usually what matters in these messages is to spot
8 delays between printouts and not really what is the absolute
9 time of the system.
10
11 Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/164]
12 ---
13  spa/plugins/support/logger.c | 9 +++++++--
14  1 file changed, 7 insertions(+), 2 deletions(-)
15
16 diff --git a/spa/plugins/support/logger.c b/spa/plugins/support/logger.c
17 index 87ba3c21..2976601c 100644
18 --- a/spa/plugins/support/logger.c
19 +++ b/spa/plugins/support/logger.c
20 @@ -27,6 +27,7 @@
21  #include <string.h>
22  #include <errno.h>
23  #include <stdio.h>
24 +#include <time.h>
25  #include <sys/eventfd.h>
26  
27  #include <spa/support/log.h>
28 @@ -70,6 +71,9 @@ impl_log_logv(struct spa_log *log,
29         const char *prefix = "", *suffix = "";
30         int size;
31         bool do_trace;
32 +       struct timespec now;
33 +
34 +       clock_gettime(CLOCK_MONOTONIC_RAW, &now);
35  
36         if ((do_trace = (level == SPA_LOG_LEVEL_TRACE && impl->have_source)))
37                 level++;
38 @@ -86,8 +90,9 @@ impl_log_logv(struct spa_log *log,
39         }
40  
41         vsnprintf(text, sizeof(text), fmt, args);
42 -       size = snprintf(location, sizeof(location), "%s[%s][%s:%i %s()] %s%s\n",
43 -               prefix, levels[level], strrchr(file, '/') + 1, line, func, text, suffix);
44 +       size = snprintf(location, sizeof(location), "%s[%s][%09lu.%06lu][%s:%i %s()] %s%s\n",
45 +               prefix, levels[level], now.tv_sec & 0x1FFFFFFF, now.tv_nsec / 1000,
46 +               strrchr(file, '/') + 1, line, func, text, suffix);
47  
48         if (SPA_UNLIKELY(do_trace)) {
49                 uint32_t index;
50 -- 
51 2.20.1
52