diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-02 21:55:13 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-02 21:55:13 +0100 |
commit | a31630e0d5b9880c716d9004ef4154396ba41ebc (patch) | |
tree | aebbd3b132e5f2dd31bc34750ccded2378fc687a /rs_speedtest.c | |
parent | 9aaac5be9db5e1537badc65242412ef14c5096e3 (diff) | |
download | ka9q-fec-a31630e0d5b9880c716d9004ef4154396ba41ebc.tar.gz ka9q-fec-a31630e0d5b9880c716d9004ef4154396ba41ebc.tar.bz2 ka9q-fec-a31630e0d5b9880c716d9004ef4154396ba41ebc.zip |
Extract fec-3.0.1
Diffstat (limited to 'rs_speedtest.c')
-rw-r--r-- | rs_speedtest.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/rs_speedtest.c b/rs_speedtest.c new file mode 100644 index 0000000..225f160 --- /dev/null +++ b/rs_speedtest.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <sys/time.h> +#include <sys/resource.h> +#include "fec.h" + +int main(){ + unsigned char block[255]; + int i; + void *rs; + struct rusage start,finish; + double extime; + int trials = 10000; + + for(i=0;i<223;i++) + block[i] = 0x01; + + rs = init_rs_char(8,0x187,112,11,32,0); + encode_rs_char(rs,block,&block[223]); + + getrusage(RUSAGE_SELF,&start); + for(i=0;i<trials;i++){ +#if 0 + block[0] ^= 0xff; /* Introduce an error */ + block[2] ^= 0xff; /* Introduce an error */ +#endif + decode_rs_char(rs,block,NULL,0); + } + getrusage(RUSAGE_SELF,&finish); + extime = finish.ru_utime.tv_sec - start.ru_utime.tv_sec + 1e-6*(finish.ru_utime.tv_usec - start.ru_utime.tv_usec); + + printf("Execution time for %d Reed-Solomon blocks using general decoder: %.2f sec\n",trials,extime); + printf("decoder speed: %g bits/s\n",trials*223*8/extime); + + + encode_rs_8(block,&block[223],0); + getrusage(RUSAGE_SELF,&start); + for(i=0;i<trials;i++){ +#if 0 + block[0] ^= 0xff; /* Introduce an error */ + block[2] ^= 0xff; /* Introduce an error */ +#endif + decode_rs_8(block,NULL,0,0); + } + getrusage(RUSAGE_SELF,&finish); + extime = finish.ru_utime.tv_sec - start.ru_utime.tv_sec + 1e-6*(finish.ru_utime.tv_usec - start.ru_utime.tv_usec); + printf("Execution time for %d Reed-Solomon blocks using CCSDS decoder: %.2f sec\n",trials,extime); + printf("decoder speed: %g bits/s\n",trials*223*8/extime); + + exit(0); +} + |