testsuite/systemtap.examples/profiling/pf2.stp
raw| 1 | #! /usr/bin/env stap |
| 2 | |
| 3 | global profile%, pcount |
| 4 | probe timer.profile { |
| 5 | pcount <<< 1 |
| 6 | fn = user_mode() ? "<user>" : symname(addr()) |
| 7 | if (fn != "") profile[fn] <<< 1 |
| 8 | } |
| 9 | probe timer.ms(5000) { |
| 10 | printf ("\n--- %d samples recorded:\n", @count(pcount)) |
| 11 | foreach (f in profile- limit 10) { |
| 12 | printf ("%-30s\t%6d\n", f, @count(profile[f])) |
| 13 | } |
| 14 | delete profile |
| 15 | delete pcount |
| 16 | } |