summaryrefslogtreecommitdiff
path: root/libavutil/eval.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-07-03 19:34:10 +0100
committerMans Rullgard <mans@mansr.com>2011-07-04 10:26:21 +0100
commit6da812e4ee6d6620d3a77ca1ac47a32161ba5aab (patch)
tree14d8ca6ab6529c38b952aeffe8e3516ee89d8ad8 /libavutil/eval.c
parent84757de0f5b32b2e7dab52b4409fcb99c3e8f65b (diff)
eval: make timing optional in test program
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavutil/eval.c')
-rw-r--r--libavutil/eval.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 4bba343bec..8ce687df19 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -533,6 +533,8 @@ int av_expr_parse_and_eval(double *d, const char *s,
#ifdef TEST
#undef printf
+#include <string.h>
+
static double const_values[] = {
M_PI,
M_E,
@@ -545,7 +547,7 @@ static const char *const_names[] = {
0
};
-int main(void)
+int main(int argc, char **argv)
{
int i;
double d;
@@ -617,13 +619,16 @@ int main(void)
NULL, NULL, NULL, NULL, NULL, 0, NULL);
printf("%f == 0.931322575\n", d);
- for (i=0; i<1050; i++) {
- START_TIMER
+ if (argc > 1 && !strcmp(argv[1], "-t")) {
+ for (i = 0; i < 1050; i++) {
+ START_TIMER;
av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
- STOP_TIMER("av_expr_parse_and_eval")
+ STOP_TIMER("av_expr_parse_and_eval");
+ }
}
+
return 0;
}
#endif