public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* simple (dumb) script to track ide drive rw times
@ 2005-10-11 18:23 William Cohen
  0 siblings, 0 replies; only message in thread
From: William Cohen @ 2005-10-11 18:23 UTC (permalink / raw)
  To: SystemTAP

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

In an attempt to code up more examples I wrote this toy example to 
record the amount of time required to service read and write accesses on 
the ide drive. It only works for ide hard disc drives and requires the 
machine to use the dma access. It doesn't really tell you where the disk 
traffic is coming from (process or file) or even the drive being 
accessed. It also doesn't take into account the size of the request. It 
is a toy example.

-Will

[-- Attachment #2: ide.stp --]
[-- Type: text/plain, Size: 1090 bytes --]

# ide.stp
# quick probe to watch for idedrive requests
# Will Cohen
# 
# FIXME this only works for dma based ide hard disk drives
# FIXME does not catch program io
# FIXME does not work for cdrom drive
#

global ide_count
global ide_count_intr
global ide_requests_start
global ide_service_time

function _(n) { return string(n) } 

function report () {
	print("ide rw requests " . _(ide_count) . "\n");
	print("ide dma intr " . _(ide_count_intr) . "\n");
	# write out info on service times
	foreach (time+ in ide_service_time) {
	  print( _(time) . "ms count = " . _(ide_service_time[time]) . "\n")
	}
}

probe kernel.function("ide_do_rw_disk")
{
	++ide_count;
	ide_requests_start[$drive] = gettimeofday_ms();
}

probe kernel.function("ide_dma_intr")
{
	++ide_count_intr;
	if (ide_requests_start[$drive]) {
		service_time = gettimeofday_ms() - ide_requests_start[$drive];
		++ide_service_time[service_time];
	}
}

probe begin {
  print ("ide tracking, start time=" . _(gettimeofday_ms()) . "\n")
}

probe end {
  report()
  print ("ide tracking, end time=" . _(gettimeofday_ms()) . "\n")
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-11 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-11 18:23 simple (dumb) script to track ide drive rw times William Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).