HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33
System: Linux li317-225.members.linode.com 3.10.0-1062.12.1.el7.x86_64 #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64
User: apache (48)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //usr/share/systemtap/examples/profiling/fntimes.stp
#!/usr/bin/stap

# usage:   fntimes.stp FUNCTIONPROBE
# e.g.     fntimes.stp 'module("ext4").function("*")'

global mincount = 100      # training: beneath this number of hits, only collect data
global note_percent = 250  # percent beyond maximum-so-far to generate report for
function time() { return gettimeofday_us() }    # time measurement function

global times

function check(t)   # t: elapsed time
{
   if (@count(times[ppfunc()]) >= mincount
       && t >= @max(times[ppfunc()]) * note_percent / 100) {   # also consider @avg()
     printf("function %s well over %s time (%d vs %d), duration variance %d s^2\n",
            ppfunc(), "maximum", t, @max(times[ppfunc()]), @variance(times[ppfunc()], 3))
     # also consider: print_backtrace()
   }
   times[ppfunc()] <<< t  # (increments @count, updates @max)
}

probe $1.return { check(time()-@entry(time())) }