This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
A systemtap example on fedora-devel-list
- From: William Cohen <wcohen at redhat dot com>
- To: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Wed, 06 Dec 2006 14:51:37 -0500
- Subject: A systemtap example on fedora-devel-list
On a thread talking about identifying the cause of a performance problem with X
Arjan mentioned a little script that he uses to see which processes end up
returning from schedule in:
https://www.redhat.com/archives/fedora-devel-list/2006-December/msg00154.html
-Will
#!/usr/bin/env stap
#
# This script continuously lists the top context switchers
#
global processes
function print_top () {
cnt=0
log ("Process\t\t\t\tCount")
printf("--------------------------------------\n")
foreach ([name] in processes-) {
printf("%-20s\t\t%5d\n",name, processes[name])
if (cnt++ == 20)
break
}
printf("--------------------------------------\n\n")
delete processes
}
probe kernel.function("schedule").return {
processes[execname()]++
}
# print top context switchers every 30 seconds
probe timer.ms(30000) {
print_top ()
}