Skip to content

Commit

Permalink
gfio: clear graphs for repeated runs on same connection
Browse files Browse the repository at this point in the history
Otherwise we get overlapping data.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Sep 26, 2012
1 parent de26d51 commit 5721d27
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ static void gfio_client_added(struct gui_entry *ge, struct fio_client *client)
gc->o_list_nr++;
}

static void gfio_clear_graph_data(struct gfio_graphs *g)
{
graph_clear_values(g->iops_graph);
graph_clear_values(g->bandwidth_graph);
}

static void connect_clicked(GtkWidget *widget, gpointer data)
{
struct gui_entry *ge = data;
Expand Down Expand Up @@ -694,6 +700,7 @@ static void connect_clicked(GtkWidget *widget, gpointer data)
if (!ge->ui->handler_running)
pthread_create(&ge->ui->t, NULL, job_thread, ge->ui);
gfio_set_state(ge, GE_STATE_CONNECTED);
gfio_clear_graph_data(&ge->graphs);
} else {
gfio_report_error(ge, "Failed to connect to %s: %s\n", ge->client->client->hostname, strerror(-ret));
}
Expand Down
11 changes: 11 additions & 0 deletions graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,17 @@ static void graph_free_labels(struct graph *g)
}
}

void graph_clear_values(struct graph *g)
{
struct flist_head *node;
struct graph_label *i;

flist_for_each(node, &g->label_list) {
i = flist_entry(node, struct graph_label, list);
graph_free_values(i);
}
}

void graph_set_color(struct graph *gr, graph_label_t label, double red,
double green, double blue)
{
Expand Down
2 changes: 2 additions & 0 deletions graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,7 @@ extern int graph_contains_xy(struct graph *p, int x, int y);
extern void graph_set_base_offset(struct graph *g, unsigned int base_offset);
extern void graph_set_graph_all_zeroes(struct graph *g, unsigned int set);

extern void graph_clear_values(struct graph *g);

#endif

0 comments on commit 5721d27

Please sign in to comment.