From adf5551ba9b5342ee9144faebc88bae72da64218 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 12 Mar 2014 07:17:23 +0000 Subject: [PATCH] Execute warmup runs with tjTransform() as well git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1159 632fc199-4ca6-4c93-a231-07263d6284db --- tjbench.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tjbench.c b/tjbench.c index 454faa5..707501d 100644 --- a/tjbench.c +++ b/tjbench.c @@ -481,7 +481,7 @@ void decompTest(char *filename) int w=0, h=0, subsamp=-1, cs=-1, _w, _h, _tilew, _tileh, _ntilesw, _ntilesh, _subsamp; char *temp=NULL, tempstr[80], tempstr2[80]; - int row, col, i, tilew, tileh, ntilesw=1, ntilesh=1, retval=0; + int row, col, i, iter, tilew, tileh, ntilesw=1, ntilesh=1, retval=0; double start, elapsed; int ps=tjPixelSize[pf], tile; @@ -602,11 +602,21 @@ void decompTest(char *filename) } } - start=gettime(); - if(tjTransform(handle, srcbuf, srcsize, _ntilesw*_ntilesh, jpegbuf, - jpegsize, t, flags)==-1) - _throwtj("executing tjTransform()"); - elapsed=gettime()-start; + iter=-warmup; + elapsed=0.; + while(1) + { + start=gettime(); + if(tjTransform(handle, srcbuf, srcsize, _ntilesw*_ntilesh, jpegbuf, + jpegsize, t, flags)==-1) + _throwtj("executing tjTransform()"); + iter++; + if(iter>=1) + { + elapsed+=gettime()-start; + if(elapsed>=benchtime) break; + } + } free(t); t=NULL; -- 2.40.0