iowatcher: Clean up some unused functions, make others static
authorAndrew Price <anprice@redhat.com>
Sun, 27 Apr 2014 02:58:40 +0000 (03:58 +0100)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:09 +0000 (12:02 -0700)
Adding -Wmissing-prototypes showed some functions could be made static
and my 'findunused' script showed some functions weren't being called.

This patch was tested by building from scratch and running with various
combinations of options.

Signed-off-by: Andrew Price <anprice@redhat.com>
iowatcher/blkparse.c
iowatcher/fio.c
iowatcher/plot.c
iowatcher/plot.h

index f837f39de9727c0add5f292d340432c338b01308..a3d9f8ae49270ea8b8c0ce53c6fe2accc99fc59f 100644 (file)
@@ -406,7 +406,7 @@ void first_record(struct trace *trace)
        trace->io = (struct blk_io_trace *)trace->cur;
 }
 
-int is_io_event(struct blk_io_trace *test)
+static int is_io_event(struct blk_io_trace *test)
 {
        char *message;
        if (!(test->action & BLK_TC_ACT(BLK_TC_NOTIFY)))
@@ -460,7 +460,7 @@ u64 find_last_time(struct trace *trace)
        return found;
 }
 
-int parse_fio_bank_message(struct trace *trace, u64 *bank_ret, u64 *offset_ret,
+static int parse_fio_bank_message(struct trace *trace, u64 *bank_ret, u64 *offset_ret,
                           u64 *num_banks_ret)
 {
        char *s;
@@ -570,7 +570,7 @@ static void map_devices(struct trace *trace)
        }
 }
 
-u64 map_io(struct trace *trace, struct blk_io_trace *io)
+static u64 map_io(struct trace *trace, struct blk_io_trace *io)
 {
        struct dev_info *di = lookup_dev(trace, io);
        u64 val = trace->io->sector << 9;
index d10f8a2b2bf06d9b4f54b4c93e3f7ce1c3d01e4b..b680f66a9ca8ad96e91c8611f89956d46446a1ff 100644 (file)
@@ -121,7 +121,7 @@ static void find_last_fio_time(struct trace *trace)
        return;
 }
 
-int read_fio(struct trace *trace, char *trace_name)
+static int read_fio(struct trace *trace, char *trace_name)
 {
        int fd;
        struct stat st;
index 885fe05c741617f099b0572b811b159a70437c83..8dd112d6c989cfcdd768b3e8acfb49c271e4fdb1 100644 (file)
@@ -145,12 +145,6 @@ struct graph_line_data *alloc_line_data(unsigned int min_seconds,
        return gld;
 }
 
-void free_line_data(struct graph_line_data *gld)
-{
-       free(gld->label);
-       free(gld);
-}
-
 struct graph_dot_data *alloc_dot_data(unsigned int min_seconds,
                                      unsigned int max_seconds,
                                      u64 min_offset, u64 max_offset,
@@ -192,11 +186,6 @@ struct graph_dot_data *alloc_dot_data(unsigned int min_seconds,
        return gdd;
 }
 
-void free_dot_data(struct graph_dot_data *gdd)
-{
-       free(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;
@@ -232,31 +221,6 @@ void set_gdd_bit(struct graph_dot_data *gdd, u64 offset, double bytes, double ti
        }
 }
 
-void print_gdd(struct graph_dot_data *gdd)
-{
-       int col = 0;
-       int row = 0;
-       int arr_index;
-       u64 val;
-       int bit_index;
-       int bit_mod;
-
-       for (row = gdd->rows - 1; row >= 0; row--) {
-               for (col = 0; col < gdd->cols; col++) {
-                       bit_index = row * gdd->cols + col;
-                       arr_index = bit_index / sizeof(unsigned long);
-                       bit_mod = bit_index % sizeof(unsigned long);
-
-                       val = gdd->data[arr_index];
-                       if (val & (1 << bit_mod))
-                               printf("*");
-                       else
-                               printf(" ");
-               }
-               printf("\n");
-       }
-}
-
 static double rolling_avg(struct graph_line_pair *data, int index, int distance)
 {
        double sum = 0;
@@ -324,33 +288,6 @@ void write_svg_header(int fd)
        write(fd, defs_close, strlen(defs_close));
 }
 
-void write_drop_shadow(struct plot *plot)
-{
-       snprintf(line, line_len, "<rect x=\"0\" y=\"%d\" width=\"%d\" height=\"%d\" fill=\"white\"/>\n",
-                plot->start_y_offset, plot->total_width, 45);
-       write(plot->fd, line, strlen(line));
-
-       snprintf(line, line_len, "<path d=\"M %d %d h %d v %d h %d t %d %d V %d H %d Z\" "
-                "fill=\"white\" filter=\"url(#shadow)\"/>",
-               0, plot->start_y_offset,
-               plot->total_width - graph_left_pad / 2,
-               -plot->total_height, 24, 1, 1,
-               plot->start_y_offset + 10, 0);
-       write(plot->fd, line, strlen(line));
-
-       snprintf(line, line_len, "<path d=\"M %d %d H %d V %d h %d V %d H %d Z\" "
-                "fill=\"white\"/>",
-               0, plot->start_y_offset - 15, /* start */
-               plot->total_width - graph_left_pad / 2 - 10, /* hline over */
-               plot->start_y_offset - plot->total_height, /* vline up */
-               15, /*hline over */
-               plot->start_y_offset, /* vline back down */
-               0);
-       write(plot->fd, line, strlen(line));
-
-       plot->start_y_offset += 45;
-}
-
 /* svg y offset for the traditional 0,0 (bottom left corner) of the plot */
 static int axis_y(void)
 {
index 02e652978be6f58aa4ee652445caf8037024e930..7e87b1d134db3a8c364bcf095f66b377a66d903f 100644 (file)
@@ -139,11 +139,8 @@ 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(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(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);
 void write_svg_header(int fd);
 struct plot *alloc_plot(void);
 int close_plot(struct plot *plot);
@@ -157,7 +154,6 @@ void set_xlabel(struct plot *plot, char *label);
 void set_ylabel(struct plot *plot, char *label);
 void scale_line_graph_bytes(u64 *max, char **units, u64 factor);
 void scale_line_graph_time(u64 *max, char **units);
-void write_drop_shadow(struct plot *plot);
 void write_drop_shadow_line(struct plot *plot);
 void svg_write_legend(struct plot *plot);
 void svg_add_legend(struct plot *plot, char *text, char *extra, char *color);