From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11217 invoked by alias); 6 Oct 2005 16:48:51 -0000 Mailing-List: contact systemtap-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sources.redhat.com Received: (qmail 11200 invoked by uid 22791); 6 Oct 2005 16:48:47 -0000 Subject: simple (dumb) script to track sizes of IOs From: Badari Pulavarty To: systemtap@sources.redhat.com Content-Type: multipart/mixed; boundary="=-8tRxFFFPiMctHWxUsi/n" Date: Thu, 06 Oct 2005 16:48:00 -0000 Message-Id: <1128617293.4754.101.camel@dyn9047017102.beaverton.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) X-SW-Source: 2005-q4/txt/msg00011.txt.bz2 --=-8tRxFFFPiMctHWxUsi/n Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1194 Hi, Here is a simple systemtap script to track the sizes of IOs that are getting generated (to the driver). Is this useful for anyone ? Earlier (before systemtap), I did this in the kernel to figure out the IO pattern thats getting generated from a database run (to check the IO merging and optimize). Since I was doing it in the kernel, I had better places to add counters to avoid all the error handling and retry cases. BTW, feel free to enhance it to complete TODO list. Is there a way, I can print in the order of IO sizes easily ? Thanks, Badari Here is the output: [root@elm3b23 systemtap.samples]# stap -g iosizes.stp io sizes tracking, start time=1128617047 iosize = 124k iocount = 1 iosize = 92k iocount = 1 iosize = 4k iocount = 11 iosize = 8k iocount = 2 iosize = 32k iocount = 2 iosize = 48k iocount = 1 iosize = 172k iocount = 1 iosize = 12k iocount = 1 iosize = 364k iocount = 1 iosize = 2k iocount = 1 iosize = 1k iocount = 1 iosize = 512k iocount = 3371 iosize = 256k iocount = 5505 iosize = 72k iocount = 1 iosize = 128k iocount = 6830 iosize = 44k iocount = 1 io sizes tracking, end time=1128617074 --=-8tRxFFFPiMctHWxUsi/n Content-Disposition: attachment; filename=iosizes.stp Content-Type: text/plain; name=iosizes.stp; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 727 #! stap # Simple (dumb) script to figure out the sizes of IOs getting # generated. # # TODO: # - sort the output by iosizes for easy read # - add per device counters # - hook it up in right places (to handle failures correctly) # global iosizes probe kernel.function("blk_rq_map_sg") { iosizes [$rq->nr_sectors] ++ } function _(n) { return string(n) } function report () { foreach (io in iosizes) { if (iosizes[io]) print("iosize = " . _(io/2) . "k\t iocount = " . _(iosizes[io]) . "\n") } delete iosizes } probe begin { print ("io sizes tracking, start time=" . _(gettimeofday_s()) . "\n") } probe end { report() print ("io sizes tracking, end time=" . _(gettimeofday_s()) . "\n") } --=-8tRxFFFPiMctHWxUsi/n--