diff options
Diffstat (limited to 'testsuite/systemtap.examples/process')
8 files changed, 73 insertions, 72 deletions
diff --git a/testsuite/systemtap.examples/process/futexes.stp b/testsuite/systemtap.examples/process/futexes.stp index 16c62937..0bd63262 100755 --- a/testsuite/systemtap.examples/process/futexes.stp +++ b/testsuite/systemtap.examples/process/futexes.stp @@ -11,26 +11,27 @@ global lock_waits # long-lived stats on (tid,lock) blockage elapsed time global process_names # long-lived pid-to-execname mapping probe syscall.futex { - if (op != FUTEX_WAIT) next # we don't care about originators of WAKE events - t = tid () - process_names[pid()] = execname() - thread_thislock[t] = $uaddr - thread_blocktime[t] = gettimeofday_us() + if (op != FUTEX_WAIT) next # we don't care about originators of WAKE events + t = tid () + process_names[pid()] = execname() + thread_thislock[t] = $uaddr + thread_blocktime[t] = gettimeofday_us() } probe syscall.futex.return { - t = tid() - ts = thread_blocktime[t] - if (ts) { - elapsed = gettimeofday_us() - ts - lock_waits[pid(), thread_thislock[t]] <<< elapsed - delete thread_blocktime[t] - delete thread_thislock[t] - } + t = tid() + ts = thread_blocktime[t] + if (ts) { + elapsed = gettimeofday_us() - ts + lock_waits[pid(), thread_thislock[t]] <<< elapsed + delete thread_blocktime[t] + delete thread_thislock[t] + } } probe end { - foreach ([pid+, lock] in lock_waits) - printf ("%s[%d] lock %p contended %d times, %d avg us\n", - process_names[pid], pid, lock, @count(lock_waits[pid,lock]), @avg(lock_waits[pid,lock])) + foreach ([pid+, lock] in lock_waits) + printf ("%s[%d] lock %p contended %d times, %d avg us\n", + process_names[pid], pid, lock, @count(lock_waits[pid,lock]), + @avg(lock_waits[pid,lock])) } diff --git a/testsuite/systemtap.examples/process/proc_snoop.stp b/testsuite/systemtap.examples/process/proc_snoop.stp index 5203c93f..06425d45 100755 --- a/testsuite/systemtap.examples/process/proc_snoop.stp +++ b/testsuite/systemtap.examples/process/proc_snoop.stp @@ -3,53 +3,53 @@ global start_ts probe begin { - start_ts = gettimeofday_us() - printf("%12s %5s %5s %-16s ACTION\n", - "TIMESTAMP", "PID", "TID", "EXECNAME") + start_ts = gettimeofday_us() + printf("%12s %5s %5s %-16s ACTION\n", + "TIMESTAMP", "PID", "TID", "EXECNAME") } function report(action:string) { - printf("%12d %5d %5d %-16s %s\n", gettimeofday_us() - start_ts, - pid(), tid(), execname(), action) + printf("%12d %5d %5d %-16s %s\n", gettimeofday_us() - start_ts, + pid(), tid(), execname(), action) } function id:string(task:long) { - return sprintf("p:%d t:%d n:%s", task_pid(task), task_tid(task), - task_execname(task)) + return sprintf("p:%d t:%d n:%s", task_pid(task), task_tid(task), + task_execname(task)) } probe process.create { - report(sprintf("create %s", id(task))) + report(sprintf("create %s", id(task))) } probe process.start { - report("start") + report("start") } probe process.exec { - report(sprintf("exec %s", filename)) + report(sprintf("exec %s", filename)) } probe process.exec_complete { - if (success) - report("exec success") - else - report(sprintf("exec failed %d (%s)", errno, errno_str(errno))) + if (success) + report("exec success") + else + report(sprintf("exec failed %d (%s)", errno, errno_str(errno))) } probe process.exit { - report(sprintf("exit %d", code)) + report(sprintf("exit %d", code)) } probe process.release { - report(sprintf("remove %s", id(task))) + report(sprintf("remove %s", id(task))) } probe signal.send { - report(sprintf("sigsend %d (%s) to %s%s", sig, sig_name, id(task), - shared? " [SHARED]" : "")) + report(sprintf("sigsend %d (%s) to %s%s", sig, sig_name, id(task), + shared? " [SHARED]" : "")) } probe signal.handle { - report(sprintf("sighandle %d (%s)", sig, sig_name)) + report(sprintf("sighandle %d (%s)", sig, sig_name)) } diff --git a/testsuite/systemtap.examples/process/sig_by_pid.stp b/testsuite/systemtap.examples/process/sig_by_pid.stp index 9c1493f5..80bf6294 100755 --- a/testsuite/systemtap.examples/process/sig_by_pid.stp +++ b/testsuite/systemtap.examples/process/sig_by_pid.stp @@ -14,29 +14,29 @@ global sigcnt, pid2name, sig2name probe begin { - print("Collecting data... Type Ctrl-C to exit and display results\n") + print("Collecting data... Type Ctrl-C to exit and display results\n") } probe signal.send { - snd_pid = pid() - rcv_pid = sig_pid + snd_pid = pid() + rcv_pid = sig_pid - sigcnt[snd_pid, rcv_pid, sig]++ + sigcnt[snd_pid, rcv_pid, sig]++ - if (!(snd_pid in pid2name)) pid2name[snd_pid] = execname() - if (!(rcv_pid in pid2name)) pid2name[rcv_pid] = pid_name - if (!(sig in sig2name)) sig2name[sig] = sig_name + if (!(snd_pid in pid2name)) pid2name[snd_pid] = execname() + if (!(rcv_pid in pid2name)) pid2name[rcv_pid] = pid_name + if (!(sig in sig2name)) sig2name[sig] = sig_name } probe end { - printf("%-8s %-16s %-5s %-16s %-16s %s\n", - "SPID", "SENDER", "RPID", "RECEIVER", "SIGNAME", "COUNT") - - foreach ([snd_pid, rcv_pid, sig_num] in sigcnt-) { - printf("%-8d %-16s %-5d %-16s %-16s %d\n", - snd_pid, pid2name[snd_pid], rcv_pid, pid2name[rcv_pid], - sig2name[sig_num], sigcnt[snd_pid, rcv_pid, sig_num]) - } + printf("%-8s %-16s %-5s %-16s %-16s %s\n", + "SPID", "SENDER", "RPID", "RECEIVER", "SIGNAME", "COUNT") + + foreach ([snd_pid, rcv_pid, sig_num] in sigcnt-) { + printf("%-8d %-16s %-5d %-16s %-16s %d\n", + snd_pid, pid2name[snd_pid], rcv_pid, pid2name[rcv_pid], + sig2name[sig_num], sigcnt[snd_pid, rcv_pid, sig_num]) + } } diff --git a/testsuite/systemtap.examples/process/sigkill.stp b/testsuite/systemtap.examples/process/sigkill.stp index 6cb6ed1e..37960637 100755 --- a/testsuite/systemtap.examples/process/sigkill.stp +++ b/testsuite/systemtap.examples/process/sigkill.stp @@ -17,7 +17,7 @@ # [...] probe signal.send { - if (sig_name == "SIGKILL") - printf("%s was sent to %s (pid:%d) by %s uid:%d\n", - sig_name, pid_name, sig_pid, execname(), uid()) + if (sig_name == "SIGKILL") + printf("%s was sent to %s (pid:%d) by %s uid:%d\n", + sig_name, pid_name, sig_pid, execname(), uid()) } diff --git a/testsuite/systemtap.examples/process/sigmon.stp b/testsuite/systemtap.examples/process/sigmon.stp index 31d7822e..1242cb5d 100755 --- a/testsuite/systemtap.examples/process/sigmon.stp +++ b/testsuite/systemtap.examples/process/sigmon.stp @@ -13,23 +13,23 @@ # # Example command line: # -# stap -x 31994 sigmon.stp SIGKILL +# stap -x 31994 sigmon.stp SIGKILL # # Example output: # -# SPID SNAME RPID RNAME SIGNUM SIGNAME -# 5609 bash 31994 find 9 SIGKILL +# SPID SNAME RPID RNAME SIGNUM SIGNAME +# 5609 bash 31994 find 9 SIGKILL # probe begin { - printf("%-8s %-16s %-5s %-16s %6s %-16s\n", - "SPID", "SNAME", "RPID", "RNAME", "SIGNUM", "SIGNAME") + printf("%-8s %-16s %-5s %-16s %6s %-16s\n", + "SPID", "SNAME", "RPID", "RNAME", "SIGNUM", "SIGNAME") } probe signal.send { - if (sig_name == @1 && sig_pid == target()) - printf("%-8d %-16s %-5d %-16s %-6d %-16s\n", - pid(), execname(), sig_pid, pid_name, sig, sig_name) + if (sig_name == @1 && sig_pid == target()) + printf("%-8d %-16s %-5d %-16s %-6d %-16s\n", + pid(), execname(), sig_pid, pid_name, sig, sig_name) } diff --git a/testsuite/systemtap.examples/process/syscalls_by_pid.stp b/testsuite/systemtap.examples/process/syscalls_by_pid.stp index 47aa4955..8f00e40d 100755 --- a/testsuite/systemtap.examples/process/syscalls_by_pid.stp +++ b/testsuite/systemtap.examples/process/syscalls_by_pid.stp @@ -14,15 +14,15 @@ global syscalls probe begin { - print ("Collecting data... Type Ctrl-C to exit and display results\n") + print ("Collecting data... Type Ctrl-C to exit and display results\n") } probe syscall.* { - syscalls[pid()]++ + syscalls[pid()]++ } probe end { - printf ("%-10s %-s\n", "#SysCalls", "PID") - foreach (pid in syscalls-) - printf("%-10d %-d\n", syscalls[pid], pid) + printf ("%-10s %-s\n", "#SysCalls", "PID") + foreach (pid in syscalls-) + printf("%-10d %-d\n", syscalls[pid], pid) } diff --git a/testsuite/systemtap.examples/process/syscalls_by_proc.stp b/testsuite/systemtap.examples/process/syscalls_by_proc.stp index af7d6932..ca5f1c01 100755 --- a/testsuite/systemtap.examples/process/syscalls_by_proc.stp +++ b/testsuite/systemtap.examples/process/syscalls_by_proc.stp @@ -14,15 +14,15 @@ global syscalls probe begin { - print ("Collecting data... Type Ctrl-C to exit and display results\n") + print ("Collecting data... Type Ctrl-C to exit and display results\n") } probe syscall.* { - syscalls[execname()]++ + syscalls[execname()]++ } probe end { - printf ("%-10s %-s\n", "#SysCalls", "Process Name") - foreach (proc in syscalls-) - printf("%-10d %-s\n", syscalls[proc], proc) + printf ("%-10s %-s\n", "#SysCalls", "Process Name") + foreach (proc in syscalls-) + printf("%-10d %-s\n", syscalls[proc], proc) } diff --git a/testsuite/systemtap.examples/process/wait4time.stp b/testsuite/systemtap.examples/process/wait4time.stp index ba300ea7..2fd914b9 100755 --- a/testsuite/systemtap.examples/process/wait4time.stp +++ b/testsuite/systemtap.examples/process/wait4time.stp @@ -53,7 +53,7 @@ probe syscall.wait4.return { t = gettimeofday_us(); p = pid() elapsed_time = t - entry_wait4[p] printf("%d %s wait4: %d %d\n", timestamp(), proc(), elapsed_time, - wait4_pid[p]) + wait4_pid[p]) delete entry_wait4[p] delete wait4_pid[p] } |