iowatcher: Make seconds unsigned
authorJan Kara <jack@suse.cz>
Thu, 4 Apr 2013 10:18:27 +0000 (06:18 -0400)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:08 +0000 (12:02 -0700)
Compiler was giving some warnings about signed vs unsigned comparisons.
Although these were harmless, make seconds unsigned because they really
are.

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

index 8993530368bfb7f33dd527da18f670b9aa9031cb..c9ae3e7409668d22a39e393d1786adecc5779592 100644 (file)
@@ -1038,7 +1038,7 @@ void add_io(struct trace *trace, struct trace_file *tf)
 
 void add_pending_io(struct trace *trace, struct graph_line_data *gld)
 {
-       int seconds;
+       unsigned int seconds;
        struct blk_io_trace *io = trace->io;
        int action = io->action & BLK_TA_MASK;
        double avg;
index 1c93a2565e54edc64b109ac92db707199c61c63f..fce9d01ed2c6be655d2bda50db76c951b74c0bd5 100644 (file)
@@ -72,9 +72,9 @@ struct trace_file {
        char *filename;
        char *label;
        struct trace *trace;
-       int stop_seconds;       /* Time when trace stops */
-       int min_seconds;        /* Beginning of the interval we should plot */
-       int max_seconds;        /* End of the interval we should plot */
+       unsigned int stop_seconds;      /* Time when trace stops */
+       unsigned int min_seconds;       /* Beginning of the interval we should plot */
+       unsigned int max_seconds;       /* End of the interval we should plot */
        u64 min_offset;
        u64 max_offset;
 
@@ -99,9 +99,9 @@ struct trace_file {
        struct graph_dot_data **gdd_writes;
        struct graph_dot_data **gdd_reads;
 
-       int mpstat_min_seconds;
-       int mpstat_max_seconds;
-       int mpstat_stop_seconds;
+       unsigned int mpstat_min_seconds;
+       unsigned int mpstat_max_seconds;
+       unsigned int mpstat_stop_seconds;
        struct graph_line_data **mpstat_gld;
 };
 
index 1fd27151722139a6bd08da8d6aff1bacdba11c4f..d10f8a2b2bf06d9b4f54b4c93e3f7ce1c3d01e4b 100644 (file)
@@ -198,7 +198,7 @@ int read_fio_event(struct trace *trace, int *time_ret, u64 *bw_ret, int *dir_ret
        return 0;
 }
 
-int add_fio_gld(int time, u64 bw, struct graph_line_data *gld)
+int add_fio_gld(unsigned int time, u64 bw, struct graph_line_data *gld)
 {
        double val;
 
index e413ffac6e61721ec036e0f8c7720fd36ccb596b..31ee473d49642f8094564415ff727e2098d5ec88 100644 (file)
@@ -18,7 +18,7 @@
 #define __FIO__
 
 int read_fio_event(struct trace *trace, int *time, u64 *bw, int *dir);
-int add_fio_gld(int time, u64 bw, struct graph_line_data *gld);
+int add_fio_gld(unsigned int time, u64 bw, struct graph_line_data *gld);
 int next_fio_line(struct trace *trace);
 struct trace *open_fio_trace(char *path);
 char *first_fio(struct trace *trace);
index 694304cd028d44433ec6c4704e7abc5bd1c70d97..5cbfa53ddf4a2e218e830c1e5d6c3b6976b07f4d 100644 (file)
@@ -414,7 +414,7 @@ static void read_trace_events(void)
        struct trace *trace;
        int ret;
        int i;
-       int time;
+       unsigned int time;
        double user, sys, iowait, irq, soft;
        double max_user = 0, max_sys = 0, max_iowait = 0,
               max_irq = 0, max_soft = 0;
@@ -445,7 +445,7 @@ static void read_trace_events(void)
 
                first_mpstat(trace);
 
-               for (time = 0; time < tf->mpstat_stop_seconds; time ++) {
+               for (time = 0; time < tf->mpstat_stop_seconds; time++) {
                        for (i = 0; i < (trace->mpstat_num_cpus + 1) * MPSTAT_GRAPHS; i += MPSTAT_GRAPHS) {
                                ret = read_mpstat_event(trace, &user, &sys,
                                                        &iowait, &irq, &soft);
@@ -531,7 +531,8 @@ static void set_blktrace_outfile(char *arg)
 }
 
 
-static void compare_minmax_tf(struct trace_file *tf, int *max_seconds, u64 *min_offset, u64 *max_offset)
+static void compare_minmax_tf(struct trace_file *tf, unsigned int *max_seconds,
+                             u64 *min_offset, u64 *max_offset)
 {
        if (tf->max_seconds > *max_seconds)
                *max_seconds = tf->max_seconds;
@@ -541,7 +542,9 @@ static void compare_minmax_tf(struct trace_file *tf, int *max_seconds, u64 *min_
                *min_offset = tf->min_offset;
 }
 
-static void set_all_minmax_tf(int min_seconds, int max_seconds, u64 min_offset, u64 max_offset)
+static void set_all_minmax_tf(unsigned int min_seconds,
+                             unsigned int max_seconds,
+                             u64 min_offset, u64 max_offset)
 {
        struct trace_file *tf;
        struct list_head *traces = &all_traces;
@@ -721,7 +724,8 @@ static int count_io_plot_types(void)
        return total_io_types;
 }
 
-static void plot_io(struct plot *plot, int min_seconds, int max_seconds, u64 min_offset, u64 max_offset)
+static void plot_io(struct plot *plot, unsigned int min_seconds,
+                   unsigned int max_seconds, u64 min_offset, u64 max_offset)
 {
        struct trace_file *tf;
        int i;
@@ -775,8 +779,8 @@ static void plot_io(struct plot *plot, int min_seconds, int max_seconds, u64 min
        close_plot(plot);
 }
 
-static void plot_tput(struct plot *plot, int min_seconds, int max_seconds,
-                     int with_legend)
+static void plot_tput(struct plot *plot, unsigned int min_seconds,
+                     unsigned int max_seconds, int with_legend)
 {
        struct trace_file *tf;
        char *units;
@@ -836,7 +840,8 @@ static void plot_tput(struct plot *plot, int min_seconds, int max_seconds,
        total_graphs_written++;
 }
 
-static void plot_fio_tput(struct plot *plot, int min_seconds, int max_seconds)
+static void plot_fio_tput(struct plot *plot,
+                         unsigned int min_seconds, unsigned int max_seconds)
 {
        struct trace_file *tf;
        char *units;
@@ -887,13 +892,13 @@ static void plot_fio_tput(struct plot *plot, int min_seconds, int max_seconds)
        total_graphs_written++;
 }
 
-static void plot_cpu(struct plot *plot, int max_seconds, char *label,
+static void plot_cpu(struct plot *plot, unsigned int max_seconds, char *label,
                     int active_index, int gld_index)
 {
        struct trace_file *tf;
        int max = 0;
        int i;
-       int gld_i;
+       unsigned int gld_i;
        char *color;
        double avg = 0;
        int ymax;
@@ -930,11 +935,11 @@ static void plot_cpu(struct plot *plot, int max_seconds, char *label,
        list_for_each_entry(tf, &all_traces, list) {
                if (tf->mpstat_gld == 0)
                        break;
-               for (i = tf->mpstat_gld[0]->min_seconds;
-                    i < tf->mpstat_gld[0]->stop_seconds; i++) {
-                       if (tf->mpstat_gld[gld_index]->data[i].count) {
-                               avg += (tf->mpstat_gld[gld_index]->data[i].sum /
-                                       tf->mpstat_gld[gld_index]->data[i].count);
+               for (gld_i = tf->mpstat_gld[0]->min_seconds;
+                    gld_i < tf->mpstat_gld[0]->stop_seconds; gld_i++) {
+                       if (tf->mpstat_gld[gld_index]->data[gld_i].count) {
+                               avg += (tf->mpstat_gld[gld_index]->data[gld_i].sum /
+                                       tf->mpstat_gld[gld_index]->data[gld_i].count);
                        }
                }
                avg /= tf->mpstat_gld[gld_index]->stop_seconds -
@@ -990,7 +995,8 @@ static void plot_cpu(struct plot *plot, int max_seconds, char *label,
        total_graphs_written++;
 }
 
-static void plot_queue_depth(struct plot *plot, int min_seconds, int max_seconds)
+static void plot_queue_depth(struct plot *plot, unsigned int min_seconds,
+                            unsigned int max_seconds)
 {
        struct trace_file *tf;
 
@@ -1191,7 +1197,8 @@ static void plot_io_movie(struct plot *plot)
        free(movie_dir);
 }
 
-static void plot_latency(struct plot *plot, int min_seconds, int max_seconds)
+static void plot_latency(struct plot *plot, unsigned int min_seconds,
+                        unsigned int max_seconds)
 {
        struct trace_file *tf;
        char *units;
@@ -1237,7 +1244,8 @@ static void plot_latency(struct plot *plot, int min_seconds, int max_seconds)
        total_graphs_written++;
 }
 
-static void plot_iops(struct plot *plot, int min_seconds, int max_seconds)
+static void plot_iops(struct plot *plot, unsigned int min_seconds,
+                     unsigned int max_seconds)
 {
        struct trace_file *tf;
        char *units;
@@ -1567,8 +1575,8 @@ static void dest_mkdir(char *dir)
 int main(int ac, char **av)
 {
        struct plot *plot;
-       int min_seconds = 0;
-       int max_seconds = 0;
+       unsigned int min_seconds = 0;
+       unsigned int max_seconds = 0;
        u64 max_offset = 0;
        u64 min_offset = ~(u64)0;
        struct trace_file *tf;
index e187685a1e40c8092ea81a44b2807e559db44b1f..885fe05c741617f099b0572b811b159a70437c83 100644 (file)
@@ -127,7 +127,9 @@ void reset_cpu_color(void)
        cpu_color_index = 0;
 }
 
-struct graph_line_data *alloc_line_data(int min_seconds, int max_seconds, int stop_seconds)
+struct graph_line_data *alloc_line_data(unsigned int min_seconds,
+                                       unsigned int max_seconds,
+                                       unsigned int stop_seconds)
 {
        int size = sizeof(struct graph_line_data) + (stop_seconds + 1) * sizeof(struct graph_line_pair);
        struct graph_line_data *gld;
@@ -149,7 +151,11 @@ void free_line_data(struct graph_line_data *gld)
        free(gld);
 }
 
-struct graph_dot_data *alloc_dot_data(int min_seconds, int max_seconds, u64 min_offset, u64 max_offset, int stop_seconds, char *color, char *label)
+struct graph_dot_data *alloc_dot_data(unsigned int min_seconds,
+                                     unsigned int max_seconds,
+                                     u64 min_offset, u64 max_offset,
+                                     unsigned int stop_seconds,
+                                     char *color, char *label)
 {
        int size;
        int arr_size;
@@ -809,7 +815,7 @@ void scale_line_graph_time(u64 *max, char **units)
 
 int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color, int thresh1, int thresh2)
 {
-       int i;
+       unsigned int i;
        double val;
        double avg;
        int rolling;
index f7dea5dcb761ad2c7df8517761f9cd4f9966ec77..02e652978be6f58aa4ee652445caf8037024e930 100644 (file)
@@ -69,12 +69,12 @@ struct graph_line_pair {
 
 struct graph_line_data {
        /* beginning of an interval displayed by this graph */
-       int min_seconds;
+       unsigned int min_seconds;
 
        /* end of an interval displayed by this graph */
-       int max_seconds;
+       unsigned int max_seconds;
 
-       int stop_seconds;
+       unsigned int stop_seconds;
 
        /* Y max */
        u64 max;
@@ -103,8 +103,8 @@ struct graph_dot_data {
        int min_seconds;
 
        /* end of an interval displayed by this graph */
-       int max_seconds;
-       int stop_seconds;
+       unsigned int max_seconds;
+       unsigned int stop_seconds;
 
        /* label for the legend */
        char *label;
@@ -138,9 +138,9 @@ char *pick_cpu_color(void);
 void reset_cpu_color(void);
 int svg_io_graph(struct plot *plot, struct graph_dot_data *gdd);
 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 min_seconds, int max_seconds, int stop_seconds);
+struct graph_line_data *alloc_line_data(unsigned int min_seconds, unsigned int max_seconds, unsigned int stop_seconds);
 void free_line_data(struct graph_line_data *gld);
-struct graph_dot_data *alloc_dot_data(int min_seconds, int max_seconds, u64 min_offset, u64 max_offset, int stop_seconds, char *color, char *label);
+struct graph_dot_data *alloc_dot_data(unsigned int min_seconds, unsigned int max_seconds, u64 min_offset, u64 max_offset, unsigned int stop_seconds, char *color, char *label);
 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);