blob: 00a47cc32d0b7b4a59558e0a7de8180fb05dc31a (
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
|
#! stap -p4
# This exercises the perfom tapset.
# for this to work the following needs to be set up:
# 1) the processor on machine supported perfmon hardware
# 2) libpfm and libpfm-devel available on machine
# 3) systemtap translator built with "--enable-perfmon"
global h1, h2
global startt, starti
probe perfmon.counter("cycles") { h1=$counter; }
probe perfmon.counter("instructions") { h2=$counter; }
probe kernel.function("sys_read"){
startt=read_counter(h1);
starti=read_counter(h2);
}
probe kernel.function("sys_read").return {
stopt=read_counter(h1);
stopi=read_counter(h2);
printf ("time = %d\n", stopt-startt);
printf ("instructions = %d\n", stopi-starti);
}
|