Measuring semaphore contention times with markers

Mike Mason mmlnx@us.ibm.com
Mon May 14 21:38:00 GMT 2007


FWIW... Here's a simple example of using markers to measure semaphore contention times.  I don't claim that it's complete or efficient, just an example of an area where markers are useful.  

This was originally written by a colleague to use kprobes.  It probes in the middle of functions in some cases.  The kprobes version hard coded those probe point addresses, requiring the addresses to be updated for each kernel.  Using markers gets rid of all the address hard coding.  I realize some of the markers could be handled by function entry kprobes.  This is just for demonstration purposes.

The tarball includes:

2.6.21-mm2-markers-patches: 
	Patches I applied to 2.6.21.1 to add marker support. Order shown in patch-order.txt.

kernel-sem-markers.patch:
	The actual semaphore markers.

sem_watch.c/Makefile:
	The marker handlers module.

log.out:
	Example output.

To try it out:
	- apply all the kernel patches, build and reboot.
	- make
	- insmod sem_watch.ko
	- do something that generates contentions (tar zxvf sometarball.tgz for example).
	- rmmod sem_watch
	- look at /var/log/messages for output

Mike Mason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sem-markers.tgz
Type: application/x-compressed
Size: 24263 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20070514/8486b795/attachment.bin>


More information about the Systemtap mailing list