summaryrefslogtreecommitdiffstats
path: root/examples/pf2.stp
blob: 5773df971bbef36bfdfd8fc86ba0216b63ea0f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /usr/bin/stap

global profile, pcount
probe timer.profile {
  pcount ++
  fn = probefunc ()
  if (fn != "") profile[fn] ++ # <<< 1 would be better ...
}
probe timer.ms(4000) {
  printf ("\n--- %d samples recorded:\n", pcount)
  foreach (f in profile- limit 10) { # ... but can only sort scalar arrays (bz #2305)
    printf ("%s\t%d\n", f, profile[f])
  }
  delete profile
  pcount = 0
}