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]

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 ()
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]