summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Price <anprice@redhat.com>2014-04-27 03:58:40 +0100
committerChris Mason <clm@fb.com>2014-09-24 12:02:09 -0700
commit5d9d4f4c13fc6db392ffb77f4f2ccca0454275de (patch)
treeb8c6c2c65f66d1c5d5848f5a74cbe5ed77f1aac6
parent1775e06be69a946feec4a4d1049648c381dc2e72 (diff)
downloadblktrace-5d9d4f4c13fc6db392ffb77f4f2ccca0454275de.tar.gz
blktrace-5d9d4f4c13fc6db392ffb77f4f2ccca0454275de.tar.bz2
iowatcher: 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--iowatcher/blkparse.c6
-rw-r--r--iowatcher/fio.c2
-rw-r--r--iowatcher/plot.c63
-rw-r--r--iowatcher/plot.h4
4 files changed, 4 insertions, 71 deletions
diff --git a/iowatcher/blkparse.c b/iowatcher/blkparse.c
index f837f39..a3d9f8a 100644
--- a/iowatcher/blkparse.c
+++ b/iowatcher/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/iowatcher/fio.c b/iowatcher/fio.c
index d10f8a2..b680f66 100644
--- a/iowatcher/fio.c
+++ b/iowatcher/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/iowatcher/plot.c b/iowatcher/plot.c
index 885fe05..8dd112d 100644
--- a/iowatcher/plot.c
+++ b/iowatcher/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/iowatcher/plot.h b/iowatcher/plot.h
index 02e6529..7e87b1d 100644
--- a/iowatcher/plot.h
+++ b/iowatcher/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);