summaryrefslogtreecommitdiff
path: root/btt/seek.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <Alan.Brunelle@hp.com>2007-09-10 18:37:49 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-09-10 18:37:49 +0200
commit4c48f14ea8ae2fae86811ac4dc1d72ad9bb601c2 (patch)
tree97a01448fa090ed0aacf979e640bf77e40b637bf /btt/seek.c
parenta5981e2e795319502cc8dda629482928f3b7b204 (diff)
downloadblktrace-4c48f14ea8ae2fae86811ac4dc1d72ad9bb601c2.tar.gz
blktrace-4c48f14ea8ae2fae86811ac4dc1d72ad9bb601c2.tar.bz2
Major revamping (ver 2.0)
After a lot of fighting with maintaining a tree-styled design (each trace having it's own node), it was just getting too cumbersome to work in all circumstances. Taking a clue from blkparse itself, I decided to just keep track of IOs at queue time, and updating fields based upon later traces. The attached (large) patch works much faster, handles larger test cases with less failures, and is managing some pretty large jobs I'm working on (large Oracle-based DB analysis - 32-way box w/ lots of storage). I've also added a Q2Q seek distance feature - it's come in handy when comparing results of IO scheduler choice: We can see what the incoming IO seek distances are (at queue time), and then see how the scheduler itself manages things (via merges & sorting) by looking at D2D seek distances generated. As noted in the subject, I arbitrarily bumped this to version 2.00 as the innards are so different. The documentation (btt/doc/btt.tex) has been updated to reflect some minor output changes. I also fixed a bug dealing with process name notification: there was a problem that if a new PID came up with a name that was previously seen, btt wouldn't keep track of it right. [When running with Oracle, a lot of processes have the same name but different PIDs of course.] Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'btt/seek.c')
-rw-r--r--btt/seek.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/btt/seek.c b/btt/seek.c
index 8738698..cbbd1a3 100644
--- a/btt/seek.c
+++ b/btt/seek.c
@@ -36,19 +36,15 @@ struct seeki {
long long last_start, last_end;
};
-static FILE *seek_open(__u32 device, char rw)
+static FILE *seek_open(char *str, char rw)
{
FILE *fp;
char *oname;
- int mjr, mnr;
if (seek_name == NULL) return NULL;
- mjr = device >> MINORBITS;
- mnr = device & ((1 << MINORBITS) - 1);
-
- oname = malloc(strlen(seek_name)+32);
- sprintf(oname, "%s_%03d,%03d_%c.dat", seek_name, mjr, mnr, rw);
+ oname = malloc(strlen(seek_name) + strlen(str) + 32);
+ sprintf(oname, "%s_%s_%c.dat", seek_name, str, rw);
if ((fp = fopen(oname, "w")) == NULL)
perror(oname);
else
@@ -124,13 +120,13 @@ long long seek_dist(struct seeki *sip, struct io *iop)
return dist;
}
-void *seeki_init(__u32 device)
+void *seeki_init(char *str)
{
struct seeki *sip = malloc(sizeof(struct seeki));
- sip->rfp = seek_open(device, 'r');
- sip->wfp = seek_open(device, 'w');
- sip->cfp = seek_open(device, 'c');
+ sip->rfp = seek_open(str, 'r');
+ sip->wfp = seek_open(str, 'w');
+ sip->cfp = seek_open(str, 'c');
sip->tot_seeks = 0;
sip->total_sectors = 0.0;
sip->last_start = sip->last_end = 0;