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]

simple (dumb) script to track ide drive rw times


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
# 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")
}

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