| 1 |
#! /usr/bin/env stap |
| 2 |
# The following line command will probe all the functions |
| 3 |
# in kernel's memory management code: |
| 4 |
# |
| 5 |
# stap functioncallcount.stp "*@mm/*.c" |
| 6 |
|
| 7 |
probe kernel.function(@1).call { # probe functions listed on commandline |
| 8 |
called[ppfunc()] <<< 1 # add a count efficiently |
| 9 |
} |
| 10 |
|
| 11 |
global called |
| 12 |
|
| 13 |
probe end { |
| 14 |
foreach (fn in called-) # Sort by call count (in decreasing order) |
| 15 |
# (fn+ in called) # Sort by function name |
| 16 |
printf("%s %d\n", fn, @count(called[fn])) |
| 17 |
exit() |
| 18 |
} |