-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtally.c
59 lines (40 loc) · 1.06 KB
/
tally.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
54
55
56
57
58
59
#include "tally.h"
/* stack stats */
int save_count = 0;
int curr_stack_depth = 0;
int max_stack_depth = 0;
/* env stats */
int lookup_count = 0;
int envs_traversed = 0;
int frames_traversed = 0;
/* llh stats */
int form_check_count = 0;
/* label stats */
int labels_passed_count = 0;
/* stat functions */
void print_stats(void) {
if (LIB) return;
printf("*** STATS ***");
NL;
printf("Total number of saves: %d", save_count);
NL;
printf("Maximum stack depth: %d", max_stack_depth);
NL;
// printf("Total number of lookups: %d", lookup_count);NL;
// printf("Total envs traversed: %d", envs_traversed);NL;
// printf("Total frames traversed: %d", frames_traversed);NL;
printf("Total syntax checks: %d", form_check_count);
NL;
printf("Total labels passed: %d", labels_passed_count);
NL;
}
void reset_stats(void) {
save_count = 0;
curr_stack_depth = 0;
max_stack_depth = 0;
lookup_count = 0;
envs_traversed = 0;
frames_traversed = 0;
form_check_count = 0;
labels_passed_count = 0;
}