diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-22 16:11:08 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-27 04:20:13 +0100 |
commit | 0fee509cf5f8452a85113c8a9a9b6e6e990b7f48 (patch) | |
tree | 103dcba220122ebbe6b50a75a188592419985788 | |
parent | 1f5d1eed78fad63f1c80a3766d3dc2421b99104d (diff) | |
download | ffmpeg-streaming-0fee509cf5f8452a85113c8a9a9b6e6e990b7f48.zip ffmpeg-streaming-0fee509cf5f8452a85113c8a9a9b6e6e990b7f48.tar.gz |
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: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavutil/timer.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavutil/timer.h b/libavutil/timer.h index 13a3c8c..f17f76b 100644 --- a/libavutil/timer.h +++ b/libavutil/timer.h @@ -69,6 +69,8 @@ static uint64_t tsum = 0; \ static int tcount = 0; \ static int tskip_count = 0; \ + static int thistogram[32] = {0}; \ + thistogram[av_log2(tend - tstart)]++; \ if (tcount < 2 || \ tend - tstart < 8 * tsum / tcount || \ tend - tstart < 2000) { \ @@ -77,9 +79,13 @@ } else \ tskip_count++; \ if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \ + int i; \ 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); \ + 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 |