diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-09-01 02:39:27 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-09-01 02:39:27 +0200 |
commit | 002e7a703accee39cf6e31855e9d6f35476d1751 (patch) | |
tree | 815337ca3d3ee135910fa2390b315741ee460ff3 /src/pulsecore | |
parent | a1c857a6a89b148e0ad786acc75a78377c045171 (diff) |
output relative timestamps in addition to absolute timestamps when logging
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/log.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index 5b799991..d7318081 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -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; |