You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavu/timer.h: factor out timer report
This commit is meant to reduce the diff in the following one.
This commit is contained in:
committed by
Clément Bœsch
parent
e0d56f097f
commit
9c0d823a7c
@@ -60,23 +60,17 @@
|
|||||||
# define FF_TIMER_UNITS "UNITS"
|
# define FF_TIMER_UNITS "UNITS"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AV_READ_TIME
|
#define TIMER_REPORT(id, tdiff) \
|
||||||
#define START_TIMER \
|
|
||||||
uint64_t tend; \
|
|
||||||
uint64_t tstart = AV_READ_TIME(); \
|
|
||||||
|
|
||||||
#define STOP_TIMER(id) \
|
|
||||||
tend = AV_READ_TIME(); \
|
|
||||||
{ \
|
{ \
|
||||||
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}; \
|
static int thistogram[32] = {0}; \
|
||||||
thistogram[av_log2(tend - tstart)]++; \
|
thistogram[av_log2(tdiff)]++; \
|
||||||
if (tcount < 2 || \
|
if (tcount < 2 || \
|
||||||
tend - tstart < 8 * tsum / tcount || \
|
(tdiff) < 8 * tsum / tcount || \
|
||||||
tend - tstart < 2000) { \
|
(tdiff) < 2000) { \
|
||||||
tsum+= tend - tstart; \
|
tsum += (tdiff); \
|
||||||
tcount++; \
|
tcount++; \
|
||||||
} else \
|
} else \
|
||||||
tskip_count++; \
|
tskip_count++; \
|
||||||
@@ -90,6 +84,15 @@
|
|||||||
av_log(NULL, AV_LOG_ERROR, "\n"); \
|
av_log(NULL, AV_LOG_ERROR, "\n"); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AV_READ_TIME
|
||||||
|
#define START_TIMER \
|
||||||
|
uint64_t tend; \
|
||||||
|
uint64_t tstart = AV_READ_TIME(); \
|
||||||
|
|
||||||
|
#define STOP_TIMER(id) \
|
||||||
|
tend = AV_READ_TIME(); \
|
||||||
|
TIMER_REPORT(id, tend - tstart)
|
||||||
#else
|
#else
|
||||||
#define START_TIMER
|
#define START_TIMER
|
||||||
#define STOP_TIMER(id) { }
|
#define STOP_TIMER(id) { }
|
||||||
|
Reference in New Issue
Block a user