Blame SOURCES/pyfuntop.stp

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