Skip to content

Commit 5721d27

Browse files
committed
gfio: clear graphs for repeated runs on same connection
Otherwise we get overlapping data. Signed-off-by: Jens Axboe <[email protected]>
1 parent de26d51 commit 5721d27

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

gfio.c

+7
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,12 @@ static void gfio_client_added(struct gui_entry *ge, struct fio_client *client)
654654
gc->o_list_nr++;
655655
}
656656

657+
static void gfio_clear_graph_data(struct gfio_graphs *g)
658+
{
659+
graph_clear_values(g->iops_graph);
660+
graph_clear_values(g->bandwidth_graph);
661+
}
662+
657663
static void connect_clicked(GtkWidget *widget, gpointer data)
658664
{
659665
struct gui_entry *ge = data;
@@ -694,6 +700,7 @@ static void connect_clicked(GtkWidget *widget, gpointer data)
694700
if (!ge->ui->handler_running)
695701
pthread_create(&ge->ui->t, NULL, job_thread, ge->ui);
696702
gfio_set_state(ge, GE_STATE_CONNECTED);
703+
gfio_clear_graph_data(&ge->graphs);
697704
} else {
698705
gfio_report_error(ge, "Failed to connect to %s: %s\n", ge->client->client->hostname, strerror(-ret));
699706
}

graph.c

+11
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,17 @@ static void graph_free_labels(struct graph *g)
853853
}
854854
}
855855

856+
void graph_clear_values(struct graph *g)
857+
{
858+
struct flist_head *node;
859+
struct graph_label *i;
860+
861+
flist_for_each(node, &g->label_list) {
862+
i = flist_entry(node, struct graph_label, list);
863+
graph_free_values(i);
864+
}
865+
}
866+
856867
void graph_set_color(struct graph *gr, graph_label_t label, double red,
857868
double green, double blue)
858869
{

graph.h

+2
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,7 @@ extern int graph_contains_xy(struct graph *p, int x, int y);
9393
extern void graph_set_base_offset(struct graph *g, unsigned int base_offset);
9494
extern void graph_set_graph_all_zeroes(struct graph *g, unsigned int set);
9595

96+
extern void graph_clear_values(struct graph *g);
97+
9698
#endif
9799

0 commit comments

Comments
 (0)