Last active
July 10, 2017 17:04
-
-
Save larytet/ab222c29d5977141d8eb6d4d27150090 to your computer and use it in GitHub Desktop.
Collect system number of syscalls using STAP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use MAXMAPENTRIES to set the maximum size of the array | |
// for example sudo stap -D MAXMAPENTRIES=40000 ./src/driver/load_measurement.stp | |
global probe_frequency% | |
global processes% | |
probe begin | |
{ | |
printf("Ctrl-C to print the results\n"); | |
} | |
probe kprocess.exec | |
{ | |
processes[pid()] = filename | |
} | |
probe syscall.read | |
{ | |
probe_frequency[pid(), name] <<< 1 | |
} | |
probe end | |
{ | |
foreach ([pid, name] in probe_frequency) | |
printf("process=%s, pid=%u, probe=%s, count=%u\n", | |
processes[pid], pid, name, | |
@count(probe_frequency[pid, name])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment