diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-09 00:15:24 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-09 01:33:52 +0400 |
commit | 6b4f58d448f4c4a077184e5f957f40083ab3c57f (patch) | |
tree | 29ee0822f0cbad45a1a8899d457694d624b80b51 | |
parent | 32584667ea51d04650daeb46c83e7838448d0ec9 (diff) |
tools/probetest: also print the time the probe functions needed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | tools/probetest.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/probetest.c b/tools/probetest.c index 7f6862a02c..dd1a0bcabb 100644 --- a/tools/probetest.c +++ b/tools/probetest.c @@ -23,11 +23,17 @@ #include "libavformat/avformat.h" #include "libavcodec/put_bits.h" #include "libavutil/lfg.h" +#include "libavutil/timer.h" #define MAX_FORMATS 1000 //this must be larger than the number of formats static int score_array[MAX_FORMATS]; +static int64_t time_array[MAX_FORMATS]; static int failures = 0; +#ifndef AV_READ_TIME +#define AV_READ_TIME(x) 0 +#endif + static void probe(AVProbeData *pd, int type, int p, int size) { int i = 0; @@ -37,7 +43,10 @@ static void probe(AVProbeData *pd, int type, int p, int size) if (fmt->flags & AVFMT_NOFILE) continue; if (fmt->read_probe) { - int score = fmt->read_probe(pd); + int score; + int64_t start = AV_READ_TIME(); + score = fmt->read_probe(pd); + time_array[i] += AV_READ_TIME() - start; if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) { score_array[i] = score; fprintf(stderr, @@ -50,6 +59,22 @@ static void probe(AVProbeData *pd, int type, int p, int size) } } +static void print_times(void) +{ + int i = 0; + AVInputFormat *fmt = NULL; + + while ((fmt = av_iformat_next(fmt))) { + if (fmt->flags & AVFMT_NOFILE) + continue; + if (time_array[i] > 1000000) { + fprintf(stderr, "%12"PRIu64" cycles, %12s\n", + time_array[i], fmt->name); + } + i++; + } +} + int main(int argc, char **argv) { unsigned int p, i, type, size, retry; @@ -142,5 +167,7 @@ int main(int argc, char **argv) } } } + if(AV_READ_TIME()) + print_times(); return failures; } |