From dcf0f7ed6b773660bd8dcc64bb3d84a9c43610bc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 23 Sep 2005 15:09:37 +0200 Subject: [PATCH] Revert "[PATCH] blkparse: rbtree sort primary key should be sequence, not time" This reverts acba447a946b022df6a30159425309f033e46ab7 commit. --- blkparse.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/blkparse.c b/blkparse.c index b72d3bb..b5da1d1 100644 --- a/blkparse.c +++ b/blkparse.c @@ -77,7 +77,7 @@ struct per_dev_info { unsigned long long last_reported_time; struct io_stats io_stats; unsigned long last_sequence; - unsigned long skips, skipped_events; + unsigned long skips; int nfiles; int ncpus; @@ -282,11 +282,7 @@ static inline int trace_rb_insert(struct trace *t) parent = *p; __t = rb_entry(parent, struct trace, rb_node); - if (t->bit->sequence < __t->bit->sequence) - p = &(*p)->rb_left; - else if (t->bit->sequence > __t->bit->sequence) - p = &(*p)->rb_right; - else if (t->bit->time < __t->bit->time) + if (t->bit->time < __t->bit->time) p = &(*p)->rb_left; else if (t->bit->time > __t->bit->time) p = &(*p)->rb_right; @@ -294,6 +290,10 @@ static inline int trace_rb_insert(struct trace *t) p = &(*p)->rb_left; else if (t->bit->device > __t->bit->device) p = &(*p)->rb_right; + else if (t->bit->sequence < __t->bit->sequence) + p = &(*p)->rb_left; + else if (t->bit->sequence > __t->bit->sequence) + p = &(*p)->rb_right; else if (t->bit->device == __t->bit->device) { fprintf(stderr, "sequence alias (%d) on device %d,%d!\n", @@ -1364,9 +1364,9 @@ static void show_device_and_cpu_stats(void) dump_io_stats(&total, line); } - fprintf(ofp, "\n%s: %'Lu entries, %'lu skips (%'lu events)\n", + fprintf(ofp, "\nEvents (%s): %'Lu entries, %'lu skips\n", get_dev_name(pdi, line, sizeof(line)), pdi->events, - pdi->skips, pdi->skipped_events); + pdi->skips); } } @@ -1485,10 +1485,7 @@ static void show_entries_rb(void) t->skipped++; break; } else { - fprintf(stderr, "skipping from %lu to %u\n", - pdi->last_sequence, bit->sequence); - pdi->skipped_events += bit->sequence - - pdi->last_sequence; + fprintf(stderr, "skipping from %lu to %u\n", pdi->last_sequence, bit->sequence); pdi->skips++; } } -- 2.25.1