iowatcher: Rename seconds to max_seconds
authorJan Kara <jack@suse.cz>
Wed, 5 Sep 2012 20:08:24 +0000 (22:08 +0200)
committerChris Mason <chris.mason@oracle.com>
Tue, 11 Sep 2012 00:53:05 +0000 (20:53 -0400)
Later we will add min_seconds to complement this.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
iowatcher/blkparse.c
iowatcher/main.c
iowatcher/plot.c
iowatcher/plot.h

index ddcf2044081aa9d4e4fce4b8b2acd6d7bf06d2d3..675a7716babb5df57b0e728b0c75b4a2cad44413 100644 (file)
@@ -638,8 +638,8 @@ void add_tput(struct trace *trace, struct graph_line_data *gld)
                return;
 
        seconds = SECONDS(io->time);
-       if (seconds > gld->seconds) {
-               fprintf(stderr, "Bad record %d %d %d\n", seconds, gld->seconds, action);
+       if (seconds > gld->max_seconds) {
+               fprintf(stderr, "Bad record %d %d %d\n", seconds, gld->max_seconds, action);
                abort();
        }
 
@@ -685,8 +685,8 @@ void add_pending_io(struct trace *trace, struct graph_line_data *gld)
                return;
 
        seconds = SECONDS(io->time);
-       if (seconds > gld->seconds) {
-               fprintf(stderr, "Bad record %d %d\n", seconds, gld->seconds);
+       if (seconds > gld->max_seconds) {
+               fprintf(stderr, "Bad record %d %d\n", seconds, gld->max_seconds);
                abort();
        }
 
@@ -759,8 +759,8 @@ void add_iop(struct trace *trace, struct graph_line_data *gld)
                return;
 
        seconds = SECONDS(io->time);
-       if (seconds > gld->seconds) {
-               fprintf(stderr, "Bad record %d %d\n", seconds, gld->seconds);
+       if (seconds > gld->max_seconds) {
+               fprintf(stderr, "Bad record %d %d\n", seconds, gld->max_seconds);
                abort();
        }
 
index 8ff2b656b988e46e4f380dd514d515389bafafe7..570c10f3905a162a5d64aea786b8419a9818e3ad 100644 (file)
@@ -161,7 +161,7 @@ struct trace_file {
        char *filename;
        char *label;
        struct trace *trace;
-       int seconds;
+       int max_seconds;
        int stop_seconds;
        u64 min_offset;
        u64 max_offset;
@@ -176,7 +176,7 @@ struct trace_file {
        struct graph_dot_data *gdd_writes;
        struct graph_dot_data *gdd_reads;
 
-       int mpstat_seconds;
+       int mpstat_max_seconds;
        int mpstat_stop_seconds;
        struct graph_line_data **mpstat_gld;
 };
@@ -280,12 +280,12 @@ static void setup_trace_file_graphs(void)
        int i;
 
        list_for_each_entry(tf, &all_traces, list) {
-               tf->tput_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
-               tf->latency_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
-               tf->queue_depth_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
-               tf->iop_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
-               tf->gdd_writes = alloc_dot_data(tf->seconds, tf->min_offset, tf->max_offset, tf->stop_seconds);
-               tf->gdd_reads = alloc_dot_data(tf->seconds, tf->min_offset, tf->max_offset, tf->stop_seconds);
+               tf->tput_gld = alloc_line_data(tf->max_seconds, tf->stop_seconds);
+               tf->latency_gld = alloc_line_data(tf->max_seconds, tf->stop_seconds);
+               tf->queue_depth_gld = alloc_line_data(tf->max_seconds, tf->stop_seconds);
+               tf->iop_gld = alloc_line_data(tf->max_seconds, tf->stop_seconds);
+               tf->gdd_writes = alloc_dot_data(tf->max_seconds, tf->min_offset, tf->max_offset, tf->stop_seconds);
+               tf->gdd_reads = alloc_dot_data(tf->max_seconds, tf->min_offset, tf->max_offset, tf->stop_seconds);
 
                if (tf->trace->mpstat_num_cpus == 0)
                        continue;
@@ -293,8 +293,8 @@ static void setup_trace_file_graphs(void)
                alloc_mpstat_gld(tf);
                for (i = 0; i < (tf->trace->mpstat_num_cpus + 1) * MPSTAT_GRAPHS; i++) {
                        tf->mpstat_gld[i] =
-                               alloc_line_data(tf->mpstat_seconds,
-                                               tf->mpstat_seconds);
+                               alloc_line_data(tf->mpstat_max_seconds,
+                                               tf->mpstat_max_seconds);
                        tf->mpstat_gld[i]->max = 100;
                }
        }
@@ -317,7 +317,7 @@ static void read_traces(void)
 
                last_time = find_last_time(trace);
                tf->trace = trace;
-               tf->seconds = SECONDS(last_time);
+               tf->max_seconds = SECONDS(last_time);
                tf->stop_seconds = SECONDS(last_time);
                find_extreme_offsets(trace, &tf->min_offset, &tf->max_offset,
                                    &max_bank, &max_bank_offset);
@@ -327,8 +327,8 @@ static void read_traces(void)
 
                read_mpstat(trace, tf->filename);
                tf->mpstat_stop_seconds = trace->mpstat_seconds;
-               tf->mpstat_seconds = trace->mpstat_seconds;
-               if (tf->mpstat_seconds)
+               tf->mpstat_max_seconds = trace->mpstat_seconds;
+               if (tf->mpstat_max_seconds)
                        found_mpstat = 1;
        }
 }
@@ -452,22 +452,22 @@ static void set_blktrace_outfile(char *arg)
 }
 
 
-static void compare_minmax_tf(struct trace_file *tf, int *seconds, u64 *min_offset, u64 *max_offset)
+static void compare_minmax_tf(struct trace_file *tf, int *max_seconds, u64 *min_offset, u64 *max_offset)
 {
-       if (tf->seconds > *seconds)
-               *seconds = tf->seconds;
+       if (tf->max_seconds > *max_seconds)
+               *max_seconds = tf->max_seconds;
        if (tf->max_offset > *max_offset)
                *max_offset = tf->max_offset;
        if (tf->min_offset < *min_offset)
                *min_offset = tf->min_offset;
 }
 
-static void set_all_minmax_tf(int seconds, u64 min_offset, u64 max_offset)
+static void set_all_minmax_tf(int max_seconds, u64 min_offset, u64 max_offset)
 {
        struct trace_file *tf;
 
        list_for_each_entry(tf, &all_traces, list) {
-               tf->seconds = seconds;
+               tf->max_seconds = max_seconds;
                tf->min_offset = min_offset;
                tf->max_offset = max_offset;
        }
@@ -550,7 +550,7 @@ static void free_all_plot_history(struct list_head *head)
        }
 }
 
-static void plot_io(struct plot *plot, int seconds, u64 min_offset, u64 max_offset)
+static void plot_io(struct plot *plot, int max_seconds, u64 min_offset, u64 max_offset)
 {
        struct trace_file *tf;
 
@@ -565,7 +565,7 @@ static void plot_io(struct plot *plot, int seconds, u64 min_offset, u64 max_offs
        set_ylabel(plot, "Offset (MB)");
        set_yticks(plot, 4, min_offset / (1024 * 1024),
                   max_offset / (1024 * 1024), "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, 0, max_seconds);
 
        list_for_each_entry(tf, &all_traces, list) {
                char *label = tf->label;
@@ -587,7 +587,7 @@ static void plot_io(struct plot *plot, int seconds, u64 min_offset, u64 max_offs
        close_plot(plot);
 }
 
-static void plot_tput(struct plot *plot, int seconds)
+static void plot_tput(struct plot *plot, int max_seconds)
 {
        struct trace_file *tf;
        char *units;
@@ -615,7 +615,7 @@ static void plot_tput(struct plot *plot, int seconds)
        sprintf(line, "%sB/s", units);
        set_ylabel(plot, line);
        set_yticks(plot, 4, 0, max, "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, 0, max_seconds);
 
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->tput_gld, tf->read_color, 0, 0);
@@ -631,7 +631,7 @@ static void plot_tput(struct plot *plot, int seconds)
        total_graphs_written++;
 }
 
-static void plot_cpu(struct plot *plot, int seconds, char *label,
+static void plot_cpu(struct plot *plot, int max_seconds, char *label,
                     int active_index, int gld_index)
 {
        struct trace_file *tf;
@@ -664,11 +664,11 @@ static void plot_cpu(struct plot *plot, int seconds, char *label,
        setup_axis(plot);
        set_plot_label(plot, label);
 
-       seconds = tf->mpstat_seconds;
+       max_seconds = tf->mpstat_max_seconds;
 
        set_yticks(plot, 4, 0, tf->mpstat_gld[gld_index]->max, "");
        set_ylabel(plot, "Percent");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, 0, max_seconds);
 
        cpu_color_index = 0;
        list_for_each_entry(tf, &all_traces, list) {
@@ -728,7 +728,7 @@ static void plot_cpu(struct plot *plot, int seconds, char *label,
        total_graphs_written++;
 }
 
-static void plot_queue_depth(struct plot *plot, int seconds)
+static void plot_queue_depth(struct plot *plot, int max_seconds)
 {
        struct trace_file *tf;
 
@@ -743,7 +743,7 @@ static void plot_queue_depth(struct plot *plot, int seconds)
        tf = list_entry(all_traces.next, struct trace_file, list);
        set_ylabel(plot, "Pending IO");
        set_yticks(plot, 4, 0, tf->queue_depth_gld->max, "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, 0, max_seconds);
 
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->queue_depth_gld, tf->read_color, 0, 0);
@@ -824,13 +824,13 @@ static void plot_io_movie(struct plot *plot)
                        set_graph_size(cols / graph_width_factor, rows / 8);
                        plot->timeline = i / graph_width_factor;
 
-                       plot_tput(plot, tf->gdd_reads->seconds);
+                       plot_tput(plot, tf->gdd_reads->max_seconds);
 
-                       plot_cpu(plot, tf->gdd_reads->seconds,
+                       plot_cpu(plot, tf->gdd_reads->max_seconds,
                                   "CPU System Time", CPU_SYS_GRAPH_INDEX, MPSTAT_SYS);
 
                        plot->direction = PLOT_ACROSS;
-                       plot_queue_depth(plot, tf->gdd_reads->seconds);
+                       plot_queue_depth(plot, tf->gdd_reads->max_seconds);
 
                        /* movie graph starts here */
                        plot->start_y_offset = orig_y_offset;
@@ -885,7 +885,7 @@ static void plot_io_movie(struct plot *plot)
        free(movie_dir);
 }
 
-static void plot_latency(struct plot *plot, int seconds)
+static void plot_latency(struct plot *plot, int max_seconds)
 {
        struct trace_file *tf;
        char *units;
@@ -913,7 +913,7 @@ static void plot_latency(struct plot *plot, int seconds)
        sprintf(line, "latency (%ss)", units);
        set_ylabel(plot, line);
        set_yticks(plot, 4, 0, max, "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, 0, max_seconds);
 
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->latency_gld, tf->read_color, 0, 0);
@@ -929,7 +929,7 @@ static void plot_latency(struct plot *plot, int seconds)
        total_graphs_written++;
 }
 
-static void plot_iops(struct plot *plot, int seconds)
+static void plot_iops(struct plot *plot, int max_seconds)
 {
        struct trace_file *tf;
        char *units;
@@ -957,7 +957,7 @@ static void plot_iops(struct plot *plot, int seconds)
        set_ylabel(plot, "IO/s");
 
        set_yticks(plot, 4, 0, max, units);
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, 0, max_seconds);
 
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->iop_gld, tf->read_color, 0, 0);
@@ -1124,7 +1124,7 @@ static int parse_options(int ac, char **av)
 int main(int ac, char **av)
 {
        struct plot *plot;
-       int seconds = 0;
+       int max_seconds = 0;
        u64 max_offset = 0;
        u64 min_offset = ~(u64)0;
        struct trace_file *tf;
@@ -1192,9 +1192,9 @@ int main(int ac, char **av)
 
        /* step two, find the maxes for time and offset */
        list_for_each_entry(tf, &all_traces, list)
-               compare_minmax_tf(tf, &seconds, &min_offset, &max_offset);
+               compare_minmax_tf(tf, &max_seconds, &min_offset, &max_offset);
        /* push the max we found into all the tfs */
-       set_all_minmax_tf(seconds, min_offset, max_offset);
+       set_all_minmax_tf(max_seconds, min_offset, max_offset);
 
        /* alloc graphing structs for all the traces */
        setup_trace_file_graphs();
@@ -1223,7 +1223,7 @@ int main(int ac, char **av)
                plot->add_xlabel = 1;
        set_plot_title(plot, graph_title);
 
-       plot_io(plot, seconds, min_offset, max_offset);
+       plot_io(plot, max_seconds, min_offset, max_offset);
        plot->add_xlabel = 0;
 
        if (columns > 1) {
@@ -1234,36 +1234,36 @@ int main(int ac, char **av)
        }
 
        check_plot_columns(plot, TPUT_GRAPH_INDEX);
-       plot_tput(plot, seconds);
+       plot_tput(plot, max_seconds);
 
        check_plot_columns(plot, CPU_IO_GRAPH_INDEX);
-       plot_cpu(plot, seconds, "CPU IO Wait Time",
+       plot_cpu(plot, max_seconds, "CPU IO Wait Time",
                 CPU_IO_GRAPH_INDEX, MPSTAT_IO);
 
        check_plot_columns(plot, CPU_SYS_GRAPH_INDEX);
-       plot_cpu(plot, seconds, "CPU System Time",
+       plot_cpu(plot, max_seconds, "CPU System Time",
                 CPU_SYS_GRAPH_INDEX, MPSTAT_SYS);
 
        check_plot_columns(plot, CPU_IRQ_GRAPH_INDEX);
-       plot_cpu(plot, seconds, "CPU IRQ Time",
+       plot_cpu(plot, max_seconds, "CPU IRQ Time",
                 CPU_IRQ_GRAPH_INDEX, MPSTAT_IRQ);
 
        check_plot_columns(plot, CPU_SOFT_GRAPH_INDEX);
-       plot_cpu(plot, seconds, "CPU SoftIRQ Time",
+       plot_cpu(plot, max_seconds, "CPU SoftIRQ Time",
                 CPU_SOFT_GRAPH_INDEX, MPSTAT_SOFT);
 
        check_plot_columns(plot, CPU_USER_GRAPH_INDEX);
-       plot_cpu(plot, seconds, "CPU User Time",
+       plot_cpu(plot, max_seconds, "CPU User Time",
                 CPU_USER_GRAPH_INDEX, MPSTAT_USER);
 
        check_plot_columns(plot, LATENCY_GRAPH_INDEX);
-       plot_latency(plot, seconds);
+       plot_latency(plot, max_seconds);
 
        check_plot_columns(plot, QUEUE_DEPTH_GRAPH_INDEX);
-       plot_queue_depth(plot, seconds);
+       plot_queue_depth(plot, max_seconds);
 
        check_plot_columns(plot, IOPS_GRAPH_INDEX);
-       plot_iops(plot, seconds);
+       plot_iops(plot, max_seconds);
 
        /* once for all */
        close_plot(plot);
index ec597ff438315568053981a65318f94d0a15936f..ed282113ae2ce361c4cb7f610dc17eaf6b7eb11c 100644 (file)
@@ -69,7 +69,7 @@ static char line[1024];
 static int final_height = 0;
 static int final_width = 0;
 
-struct graph_line_data *alloc_line_data(int seconds, int stop_seconds)
+struct graph_line_data *alloc_line_data(int max_seconds, int stop_seconds)
 {
        int size = sizeof(struct graph_line_data) + (stop_seconds + 1) * sizeof(struct graph_line_pair);
        struct graph_line_data *gld;
@@ -79,7 +79,7 @@ struct graph_line_data *alloc_line_data(int seconds, int stop_seconds)
                fprintf(stderr, "Unable to allocate memory for graph data\n");
                exit(1);
        }
-       gld->seconds = seconds;
+       gld->max_seconds = max_seconds;
        gld->stop_seconds = stop_seconds;
        return gld;
 }
@@ -90,7 +90,7 @@ void free_line_data(struct graph_line_data *gld)
        free(gld);
 }
 
-struct graph_dot_data *alloc_dot_data(int seconds, u64 min_offset, u64 max_offset, int stop_seconds)
+struct graph_dot_data *alloc_dot_data(int max_seconds, u64 min_offset, u64 max_offset, int stop_seconds)
 {
        int size;
        int arr_size;
@@ -111,7 +111,7 @@ struct graph_dot_data *alloc_dot_data(int seconds, u64 min_offset, u64 max_offse
                fprintf(stderr, "Unable to allocate memory for graph data\n");
                exit(1);
        }
-       gdd->seconds = seconds;
+       gdd->max_seconds = max_seconds;
        gdd->stop_seconds = stop_seconds;
        gdd->rows = rows;
        gdd->cols = cols;
@@ -128,7 +128,7 @@ void free_dot_data(struct graph_dot_data *gdd)
 void set_gdd_bit(struct graph_dot_data *gdd, u64 offset, double bytes, double time)
 {
        double bytes_per_row = (double)(gdd->max_offset - gdd->min_offset + 1) / gdd->rows;
-       double secs_per_col = (double)gdd->seconds / gdd->cols;
+       double secs_per_col = (double)gdd->max_seconds / gdd->cols;
        double col;
        double row;
        int col_int;
@@ -706,7 +706,7 @@ int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color,
        int fd = plot->fd;
        char *start = "<path d=\"";
        double yscale = ((double)gld->max) / graph_height;
-       double xscale = (double)(gld->seconds - 1) / graph_width;
+       double xscale = (double)(gld->max_seconds - 1) / graph_width;
        char c = 'M';
        double x;
        int printed_header = 0;
index d70abcb4b83a7922adc830625667fadf9050bffd..e5279158debf21a412ebc9ec42ad25e4c93e4175 100644 (file)
@@ -69,7 +69,7 @@ struct graph_line_pair {
 
 struct graph_line_data {
        /* total number of seconds in this graph */
-       int seconds;
+       int max_seconds;
 
        int stop_seconds;
 
@@ -97,7 +97,7 @@ struct graph_dot_data {
        int cols;
 
        /* total number of seconds in this graph */
-       int seconds;
+       int max_seconds;
        int stop_seconds;
 
        /* label for the legend */
@@ -119,9 +119,9 @@ struct plot_history {
 
 int svg_io_graph(struct plot *plot, struct graph_dot_data *gdd, char *color);
 int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color, int thresh1, int thresh2);
-struct graph_line_data *alloc_line_data(int seconds, int stop_seconds);
+struct graph_line_data *alloc_line_data(int max_seconds, int stop_seconds);
 void free_line_data(struct graph_line_data *gld);
-struct graph_dot_data *alloc_dot_data(int seconds, u64 min_offset, u64 max_offset, int stop_seconds);
+struct graph_dot_data *alloc_dot_data(int max_seconds, u64 min_offset, u64 max_offset, int stop_seconds);
 void free_dot_data(struct graph_dot_data *gdd);
 void set_gdd_bit(struct graph_dot_data *gdd, u64 offset, double bytes, double time);
 void print_gdd(struct graph_dot_data *gdd);