[FFmpeg-cvslog] tools/probetest: also print the time the probe functions needed
Michael Niedermayer
git at videolan.org
Fri Nov 8 22:40:25 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov 8 21:15:24 2013 +0100| [6b4f58d448f4c4a077184e5f957f40083ab3c57f] | committer: Michael Niedermayer
tools/probetest: also print the time the probe functions needed
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b4f58d448f4c4a077184e5f957f40083ab3c57f
---
tools/probetest.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/tools/probetest.c b/tools/probetest.c
index 7f6862a..dd1a0bc 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;
}
More information about the ffmpeg-cvslog
mailing list