crc_timing.c
上传用户:aoeyumen
上传日期:2007-01-06
资源大小:3329k
文件大小:1k
- /*
- * uncouple_timing.c
- *
- * Aaron Holtzman - May 1999
- *
- */
- #define HAVE_TSC
- #include <stdio.h>
- #include "ac3.h"
- #include "decode.h"
- #include "bitstream.h"
- #include "imdct.h"
- #include "timing.h"
- void convert_to_float(uint_16 exp, uint_16 mant, uint_32 *dest);
- uint_64 correction;
- void main(int argc,char *argv[])
- {
- int i;
- float foo;
- double time;
- double time_acc;
- uint_64 start,end,elapsed,correction;
- uint_32 iters = 100000;
- uint_16 data;
- uint_16 numbits;
- double mean = 0;
- double variance = 0;
- correction = timing_init();
- printf("nCorrection Factor = %lldn",correction);
- printf("Timing convert_to_float %d timesn",iters);
- for (i = 0; i < iters; i++)
- {
- data = rand();
- numbits = rand() % 16;
- start = get_time();
- crc_process(data ,numbits,&foo);
- end = get_time();
- //printf("Iteration %d - %lld nsecn",i,end - start);
- if(i>0)
- {
- elapsed = end - start - correction;
- mean += elapsed;
- variance += elapsed * elapsed;
-
- }
- }
-
- mean /= iters;
- variance /= iters;
- variance -= mean * mean;
- printf("mean = %fn",mean);
- printf("variance= %fn",variance);
- }