aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Price <anprice@redhat.com>2014-04-27 03:58:40 +0100
committerAndrew Price <anprice@redhat.com>2014-04-27 03:58:40 +0100
commit33a916ace6bb3264fc1b2d3aec4c03fb0fc7650e (patch)
tree5eda64720fffd45f6dfb2b28b2273a861da50e95
parent8562619e967d57aa34f8b6b2cec49a139197fa40 (diff)
downloadiowatcher-33a916ace6bb3264fc1b2d3aec4c03fb0fc7650e.tar.gz
Clean up some unused functions, make others static
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>
-rw-r--r--blkparse.c6
-rw-r--r--fio.c2
-rw-r--r--plot.c63
-rw-r--r--plot.h4
4 files changed, 4 insertions, 71 deletions
diff --git a/blkparse.c b/blkparse.c
index f837f39..a3d9f8a 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -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;
diff --git a/fio.c b/fio.c
index d10f8a2..b680f66 100644
--- a/fio.c
+++ b/fio.c
@@ -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;
diff --git a/plot.c b/plot.c
index 885fe05..8dd112d 100644
--- a/plot.c
+++ b/plot.c
@@ -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)
{
diff --git a/plot.h b/plot.h
index 02e6529..7e87b1d 100644
--- a/plot.h
+++ b/plot.h
@@ -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);