summaryrefslogtreecommitdiffstats
path: root/testsuite/buildok/pmap_foreach.stp
blob: 5a52c9d6dd01dc1bb72fea109e292122cea84795 (plain)
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
#! stap -p4

global foo


probe begin {
	for (i=0;i<10;i+=2) { 
		foo[1] <<< i	
		foo[2] <<< i*i
		foo[3] <<< i*i*i
	}
	foo[3] <<< 4*4*4
	exit()
}

probe end {
	for (i=1;i<4;i++) {
		printf("count of foo[%d] = %d\n", i, @count(foo[i]))
		printf("first bucket of hist_log of foo[%d] = %d\n",
				i, @hist_log(foo[i])[0])
		print(@hist_log(foo[i]))
	}

	foreach (i in foo) {
		printf("count of foo[%d] = %d\n", i, @count(foo[i]))
		printf("first bucket of hist_log of foo[%d] = %d\n",
				i, @hist_log(foo[i])[0])
		print(@hist_log(foo[i]))
	}

	foreach (i+ in foo) {
		printf("count of foo[%d] = %d\n", i, @count(foo[i]))
		printf("first bucket of hist_log of foo[%d] = %d\n",
				i, @hist_log(foo[i])[0])
		print(@hist_log(foo[i]))
	}
}