summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iowatcher/blkparse.c16
-rw-r--r--iowatcher/blkparse.h1
-rw-r--r--iowatcher/main.c9
3 files changed, 11 insertions, 15 deletions
diff --git a/iowatcher/blkparse.c b/iowatcher/blkparse.c
index d27b547..c70b1bd 100644
--- a/iowatcher/blkparse.c
+++ b/iowatcher/blkparse.c
@@ -188,6 +188,11 @@ struct pid_map {
#define DOUBLE_TO_NANO_ULL(d) ((unsigned long long)((d) * 1000000000))
#define CHECK_MAGIC(t) (((t)->magic & 0xffffff00) == BLK_IO_TRACE_MAGIC)
+u64 get_record_time(struct trace *trace)
+{
+ return trace->io->time;
+}
+
void init_io_hash_table(void)
{
int i;
@@ -960,9 +965,6 @@ void add_tput(struct trace *trace, struct graph_line_data *writes_gld,
gld = writes_gld;
seconds = SECONDS(io->time);
- if (seconds > gld->max_seconds)
- return;
-
gld->data[seconds].sum += io->bytes;
gld->data[seconds].count = 1;
@@ -1060,10 +1062,6 @@ void add_pending_io(struct trace *trace, struct graph_line_data *gld)
if (action != __BLK_TA_ISSUE)
return;
- seconds = SECONDS(io->time);
- if (seconds > gld->max_seconds)
- return;
-
pio = hash_dispatched_io(trace->io);
if (!pio)
return;
@@ -1075,6 +1073,7 @@ void add_pending_io(struct trace *trace, struct graph_line_data *gld)
ios_in_flight++;
+ seconds = SECONDS(io->time);
gld->data[seconds].sum += ios_in_flight;
gld->data[seconds].count++;
@@ -1138,9 +1137,6 @@ void add_iop(struct trace *trace, struct graph_line_data *gld)
return;
seconds = SECONDS(io->time);
- if (seconds > gld->max_seconds)
- return;
-
gld->data[seconds].sum += 1;
gld->data[seconds].count = 1;
if (gld->data[seconds].sum > gld->max)
diff --git a/iowatcher/blkparse.h b/iowatcher/blkparse.h
index 84bda4a..1c93a25 100644
--- a/iowatcher/blkparse.h
+++ b/iowatcher/blkparse.h
@@ -133,5 +133,6 @@ void add_tput(struct trace *trace, struct graph_line_data *writes_gld,
struct graph_line_data *reads_gld);
void add_pending_io(struct trace *trace, struct graph_line_data *gld);
int next_record(struct trace *trace);
+u64 get_record_time(struct trace *trace);
void first_record(struct trace *trace);
#endif
diff --git a/iowatcher/main.c b/iowatcher/main.c
index a419324..694304c 100644
--- a/iowatcher/main.c
+++ b/iowatcher/main.c
@@ -426,17 +426,16 @@ static void read_trace_events(void)
trace = tf->trace;
first_record(trace);
- while (1) {
+ do {
+ if (SECONDS(get_record_time(trace)) > tf->max_seconds)
+ continue;
check_record(trace);
add_tput(trace, tf->tput_writes_gld, tf->tput_reads_gld);
add_iop(trace, tf->iop_gld);
add_io(trace, tf);
add_pending_io(trace, tf->queue_depth_gld);
add_completed_io(trace, tf->latency_gld);
- ret = next_record(trace);
- if (ret)
- break;
- }
+ } while (!(ret = next_record(trace)));
}
list_for_each_entry(tf, &all_traces, list) {
trace = tf->trace;