Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.maps/agg_delete2.stp

raw
1 global index = 0
2 global stats
3 global timer_index
4
5 probe timer.profile {
6 stats[0, 0] <<< index++
7 stats[0, 1] <<< 1
8 }
9
10 probe timer.s(5) {
11 if (++timer_index > 3) exit()
12
13 for (b = 0; b < 2; b++) {
14 printf("[%d, %d]: %d\n", 0, b,
15 (b == 0 ? @max(stats[0, b]) : @count(stats[0, b])))
16 }
17 delete stats
18 for (b = 0; b < 2; b++) {
19 if ([0, b] in stats) {
20 printf("eek! [%d, %d] in stats after deletion??\n",
21 0, b);
22 }
23 if (@count(stats[0, b]) != 0) {
24 printf("eek! [%d, %d] @count() != 0 after deletion??\n",
25 0, b);
26 }
27 }
28 }