This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Attachment:
topsys.pl
Description: Perl program
#! stap -g # # This script lists the top 20 system calls in the interval of 2000 jiffies. # global syscalls_count function syscall_name:string () %{ char *str, buff[80]; char *tok; str = buff; strlcpy(str, CONTEXT->probe_point, sizeof(buff)); tok = strsep(&str, "\""); tok = strsep(&str, "@"); strlcpy(THIS->__retvalue, tok, MAXSTRINGLEN); %} function accumulate () { syscall=syscall_name() syscalls_count[syscall]++ } function print_systop () { foreach ([syscall] in syscalls_count) { sys_cnt = syscalls_count[syscall] log (syscall . "\t" . string(sys_cnt)) } } probe kernel.function("sys_*") { accumulate () } probe timer.jiffies(2000) { exit () } probe end { print_systop () }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |