-
Notifications
You must be signed in to change notification settings - Fork 1
/
rs_speedtest.c
54 lines (44 loc) · 1.25 KB
/
rs_speedtest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/times.h>
#include "rs.h"
main(){
char block[255];
int i;
void *rs;
struct tms 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]);
times(&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);
}
times(&finish);
extime = ((double)(finish.tms_utime-start.tms_utime))/CLK_TCK;
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);
times(&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);
}
times(&finish);
extime = ((double)(finish.tms_utime-start.tms_utime))/CLK_TCK;
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);
}