File: print_histogram_entry.stp

package info (click to toggle)
systemtap 4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,000 kB
  • sloc: cpp: 78,785; ansic: 62,419; xml: 49,443; exp: 42,735; sh: 11,254; python: 3,062; perl: 2,252; tcl: 1,305; makefile: 1,072; lisp: 105; awk: 101; asm: 91; java: 56; sed: 16
file content (32 lines) | stat: -rwxr-xr-x 630 bytes parent folder | download | duplicates (9)
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
#! 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))
	for (i = 0; i < 7; ++i)
		printf("bucket %d: %d\n", i, @hist_log(foo)[i])
	println("the first bucket is ", @hist_log(foo)[0])
	println(@hist_log(foo)[0], " is the first bucket")
	println(1 + @hist_log(foo)[0], " is one plus the first bucket")
	// XXX the parser fails on this bucket expression:
	// println(@hist_log(foo)[0] + 1, " is the first bucket plus one")
}