#! 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]))
	}

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