summaryrefslogtreecommitdiffstats
path: root/testsuite/buildok/iterate_histogram_buckets.stp
blob: 15bba00c2fe021c0032dba9ab804a047867278df (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
#! stap -p4

global foo
global i

probe begin
{
	print("starting up\n")
	i = 0
}

probe timer.jiffies(100)
{
	printf("ping %d\n", i)
	foo <<< i
	if (i++ > 15)
		exit()
}

probe end
{
	print("shutting down\n")
	printf("count %d, avg %d\n", @count(foo), @avg(foo))
	foreach (bucket in @hist_log(foo))
	{	
		if (@hist_log(foo)[bucket] > 0)
			printf("bucket %d: %d\n", bucket, @hist_log(foo)[bucket])
#               XXX: both these should work, but histogram for() loops
#		     are emitted incorrectly
#               break 
#		continue
	}
}