File: onoffprobe.stp

package info (click to toggle)
systemtap 5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 47,964 kB
  • sloc: cpp: 80,838; ansic: 54,757; xml: 49,725; exp: 43,665; sh: 11,527; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (54 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download | duplicates (7)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
global switch=-1

#begin probe
probe begin if (switch==-1) {
	printf("begin1 probed: %s\n", module_name());
}

probe begin if (switch==0) {
	log("begin2 probed");
}

#dwarf probe (return)
#
# Note that we were originally probing
# kernel.function("vfs_write").return here. However, on some kernels
# (like 3.10.0-327.el7.ppc64), vfs_write() could be inlined, so we'd
# miss the return. 
probe syscall.write.return if (switch == 1) {
	log("function return probed")
	switch = 0
}

#dwarf probe (entry)
probe syscall.write if (switch == 2) {
	log("function entry probed")
	switch = 0
}

#timer probe
probe timer.ms(100) if (switch == 3) {
	log("timer probed")
	switch = 0
}

#profile probe
probe timer.profile if (switch == 4) {
	log("profile probed")
	switch = 0
}

# aliasess
probe alias.one.a  = timer.ms(150) if (switch == 5) { print("alias.one.a and") }
probe alias.one.b  = timer.ms(200) if (switch == 6) { print("alias.one.b and") }
probe alias.one = alias.one.* if (switch >= 5 && switch < 7) { print(" alias.one and") }
probe alias.two = timer.ms(250) if (switch == 7) { print("alias.two and") }
probe alias.* if (switch) { log(" alias.* probed") }

probe procfs("switch").write {
	switch = strtol($value, 10)
	if (switch > 7) {
		exit()
	}
}