c22243
#!/usr/bin/stap 
c22243
c22243
global fn_calls;
c22243
c22243
probe python.function.entry
c22243
{ 
c22243
  fn_calls[pid(), filename, funcname, lineno] += 1;
c22243
}
c22243
c22243
probe timer.ms(1000) {
c22243
    printf("\033[2J\033[1;1H") /* clear screen */
c22243
    printf("%6s %80s %6s %30s %6s\n",
c22243
           "PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
c22243
    foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {
c22243
        printf("%6d %80s %6d %30s %6d\n",
c22243
            pid, filename, lineno, funcname,
c22243
            fn_calls[pid, filename, funcname, lineno]);
c22243
    }
c22243
c22243
    delete fn_calls;
c22243
}