5 int main(int argc, char **argv) {
7 fprintf(stderr, "Usage:\n\tck-convcore [lcov trace file]\n");
11 FILE *tracefile = fopen(argv[1], "r");
12 if(tracefile == NULL) {
13 fprintf(stderr, "Error: couldn't open tracefile %s\n", argv[1]);
17 int inCK = 0, inCONV = 0, finishedCK = 0, finishedCONV = 0;
18 int FNFck = 0, FNHck = 0, LHck = 0, LFck = 0;
19 int FNFconv = 0, FNHconv = 0, LHconv = 0, LFconv = 0;
22 while(getline(&lineptr, &n, tracefile) != -1) {
24 if(lineptr[0] == 'F' && lineptr[1] == 'N' && lineptr[2] == 'F')
25 FNFck = atoi(lineptr + 4);
26 else if(lineptr[0] == 'F' && lineptr[1] == 'N' && lineptr[2] == 'H')
27 FNHck = atoi(lineptr + 4);
28 else if(lineptr[0] == 'L' && lineptr[1] == 'F')
29 LFck = atoi(lineptr + 3);
30 else if(lineptr[0] == 'L' && lineptr[1] == 'H') {
31 LHck = atoi(lineptr + 3);
34 if(finishedCK && finishedCONV)
38 if(lineptr[0] == 'F' && lineptr[1] == 'N' && lineptr[2] == 'F')
39 FNFconv = atoi(lineptr + 4);
40 else if(lineptr[0] == 'F' && lineptr[1] == 'N' && lineptr[2] == 'H')
41 FNHconv = atoi(lineptr + 4);
42 else if(lineptr[0] == 'L' && lineptr[1] == 'F')
43 LFconv = atoi(lineptr + 3);
44 else if(lineptr[0] == 'L' && lineptr[1] == 'H') {
45 LHconv = atoi(lineptr + 3);
48 if(finishedCK && finishedCONV)
51 } else if(lineptr[0] == 'S' && lineptr[1] == 'F') {
52 if(strstr(lineptr, "tmp/ck.C") != NULL)
54 else if(strstr(lineptr, "tmp/convcore.c") != NULL)
56 else if(strstr(lineptr, "tmp/convcore.C") != NULL)
70 printf("Summary ck.C in %s:\n", argv[1]);
71 printf("\tlines......: %.1f%% (%d of %d lines)\n", ((double)(100 * LHck) / LFck), LHck, LFck);
72 printf("\tfunctions..: %.1f%% (%d of %d functions)\n", ((double)(100 * FNHck) / FNFck), FNHck, FNFck);
74 printf("Summary convcore.C in %s:\n", argv[1]);
75 printf("\tlines......: %.1f%% (%d of %d lines)\n", ((double)(100 * LHconv) / LFconv), LHconv, LFconv);
76 printf("\tfunctions..: %.1f%% (%d of %d functions)\n", ((double)(100 * FNHconv) / FNFconv), FNHconv, FNFconv);