Debian Codegraph @

testsuite/systemtap.examples/memory/swapmonitor.stp

raw
1 #! /usr/bin/env stap
2
3 global swap_result
4 probe kernel.function("swap_read_folio")!, kernel.function("swap_readpage") {
5 swap_result[tz_ctime(gettimeofday_s()),ppfunc(),execname(),pid()] <<< 1
6 }
7 probe kernel.function("swap_write_folio")!, kernel.function("swap_writepage") {
8 swap_result[tz_ctime(gettimeofday_s()),ppfunc(),execname(),pid()] <<< 1
9 }
10
11 probe begin {
12 printf("%-30s %-15s %-25s %-10s %-10s \n","TIME","FUNC","COMM","PID", "COUNT")
13 }
14
15 probe timer.s(10) {
16 foreach ([t+,f,n,p] in swap_result) {
17 printf("%-30s %-15s %-25s %-10d %-10d \n",t,f,n,p,@count(swap_result[t,f,n,p]))
18 }
19 delete(swap_result)
20 }