Commit 0fee509c authored by Michael Niedermayer's avatar Michael Niedermayer

avutil/timer: show histogram of cpu cycles each run took

The new information is printed at verbose log level and can thus be switched on and off
through the log level
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1f5d1eed
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
static uint64_t tsum = 0; \ static uint64_t tsum = 0; \
static int tcount = 0; \ static int tcount = 0; \
static int tskip_count = 0; \ static int tskip_count = 0; \
static int thistogram[32] = {0}; \
thistogram[av_log2(tend - tstart)]++; \
if (tcount < 2 || \ if (tcount < 2 || \
tend - tstart < 8 * tsum / tcount || \ tend - tstart < 8 * tsum / tcount || \
tend - tstart < 2000) { \ tend - tstart < 2000) { \
...@@ -77,9 +79,13 @@ ...@@ -77,9 +79,13 @@
} else \ } else \
tskip_count++; \ tskip_count++; \
if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \ if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \
int i; \
av_log(NULL, AV_LOG_ERROR, \ av_log(NULL, AV_LOG_ERROR, \
"%"PRIu64" " FF_TIMER_UNITS " in %s, %d runs, %d skips\n", \ "%"PRIu64" " FF_TIMER_UNITS " in %s, %d runs, %d skips", \
tsum * 10 / tcount, id, tcount, tskip_count); \ tsum * 10 / tcount, id, tcount, tskip_count); \
for (i = 0; i < 32; i++) \
av_log(NULL, AV_LOG_VERBOSE, " %2d", av_log2(2*thistogram[i]));\
av_log(NULL, AV_LOG_ERROR, "\n"); \
} \ } \
} }
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment