public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: SystemTAP <systemtap@sources.redhat.com>
Subject: simple (dumb) script to track ide drive rw times
Date: Tue, 11 Oct 2005 18:23:00 -0000	[thread overview]
Message-ID: <434C0320.700@redhat.com> (raw)

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

                 reply	other threads:[~2005-10-11 18:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=434C0320.700@redhat.com \
    --to=wcohen@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).