mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
output relative timestamps in addition to absolute timestamps when logging
This commit is contained in:
parent
a1c857a6a8
commit
002e7a703a
1 changed files with 14 additions and 4 deletions
|
|
@ -139,18 +139,28 @@ void pa_log_levelv_meta(
|
|||
location[0] = 0;
|
||||
|
||||
if (getenv(ENV_LOGTIME)) {
|
||||
static pa_usec_t start;
|
||||
pa_usec_t u;
|
||||
static pa_usec_t start, last;
|
||||
pa_usec_t u, a, r;
|
||||
|
||||
u = pa_rtclock_usec();
|
||||
|
||||
PA_ONCE_BEGIN {
|
||||
start = u;
|
||||
last = u;
|
||||
} PA_ONCE_END;
|
||||
|
||||
u -= start;
|
||||
r = u - last;
|
||||
a = u - start;
|
||||
|
||||
pa_snprintf(timestamp, sizeof(timestamp), "(%4llu.%03llu) ", (unsigned long long) (u / PA_USEC_PER_SEC), (unsigned long long) (((u / PA_USEC_PER_MSEC)) % 1000));
|
||||
/* This is not thread safe, but this is a debugging tool only
|
||||
* anyway. */
|
||||
last = u;
|
||||
|
||||
pa_snprintf(timestamp, sizeof(timestamp), "(%4llu.%03llu|%4llu.%03llu) ",
|
||||
(unsigned long long) (a / PA_USEC_PER_SEC),
|
||||
(unsigned long long) (((a / PA_USEC_PER_MSEC)) % 1000),
|
||||
(unsigned long long) (r / PA_USEC_PER_SEC),
|
||||
(unsigned long long) (((r / PA_USEC_PER_MSEC)) % 1000));
|
||||
|
||||
} else
|
||||
timestamp[0] = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue