From 6fdf35fe35d8c1c467708238100648a7a47c930d Mon Sep 17 00:00:00 2001 From: Olivier Langlois Date: Tue, 6 May 2014 17:16:49 -0400 Subject: lavc: Use av_gettime_relative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whenever av_gettime() is used to measure relative period of time, av_gettime_relative() is prefered as it guarantee monotonic time on supported platforms. Signed-off-by: Martin Storsjö --- libavcodec/dct-test.c | 8 ++++---- libavcodec/fft-test.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c index 32cbe8c52c..f337576836 100644 --- a/libavcodec/dct-test.c +++ b/libavcodec/dct-test.c @@ -231,7 +231,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed) init_block(block, test, is_idct, &prng); permute(block1, block, dct->perm_type); - ti = av_gettime(); + ti = av_gettime_relative(); it1 = 0; do { for (it = 0; it < NB_ITS_SPEED; it++) { @@ -239,7 +239,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed) dct->func(block); } it1 += NB_ITS_SPEED; - ti1 = av_gettime() - ti; + ti1 = av_gettime_relative() - ti; } while (ti1 < 1000000); emms_c(); @@ -372,7 +372,7 @@ static void idct248_error(const char *name, if (!speed) return; - ti = av_gettime(); + ti = av_gettime_relative(); it1 = 0; do { for (it = 0; it < NB_ITS_SPEED; it++) { @@ -381,7 +381,7 @@ static void idct248_error(const char *name, idct248_put(img_dest, 8, block); } it1 += NB_ITS_SPEED; - ti1 = av_gettime() - ti; + ti1 = av_gettime_relative() - ti; } while (ti1 < 1000000); emms_c(); diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c index f62cf0d2bc..b7c83cf800 100644 --- a/libavcodec/fft-test.c +++ b/libavcodec/fft-test.c @@ -439,7 +439,7 @@ int main(int argc, char **argv) /* we measure during about 1 seconds */ nb_its = 1; for (;;) { - time_start = av_gettime(); + time_start = av_gettime_relative(); for (it = 0; it < nb_its; it++) { switch (transform) { case TRANSFORM_MDCT: @@ -464,7 +464,7 @@ int main(int argc, char **argv) #endif /* FFT_FLOAT */ } } - duration = av_gettime() - time_start; + duration = av_gettime_relative() - time_start; if (duration >= 1000000) break; nb_its *= 2; -- cgit v1.2.3