graph: return opaque graph_label_t for each label added
[fio.git] / gfio.c
diff --git a/gfio.c b/gfio.c
index cf6b5090e26c9e945eb8f6e8ab7b5959237b14c0..8fd57393b34a0249c4f32eefe5298be66bda85b8 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -75,43 +75,45 @@ static struct button_spec {
        },
 };
 
-static struct graph *setup_iops_graph(void)
+static void setup_iops_graph(struct gfio_graphs *gg)
 {
        struct graph *g;
 
        g = graph_new(DRAWING_AREA_XDIM / 2.0, DRAWING_AREA_YDIM, gfio_graph_font);
        graph_title(g, "IOPS (IOs/sec)");
        graph_x_title(g, "Time (secs)");
-       graph_add_label(g, "Read IOPS");
-       graph_add_label(g, "Write IOPS");
-       graph_set_color(g, "Read IOPS", 0.13, 0.54, 0.13);
-       graph_set_color(g, "Write IOPS", 1.0, 0.0, 0.0);
+       gg->read_iops = graph_add_label(g, "Read IOPS");
+       gg->write_iops = graph_add_label(g, "Write IOPS");
+       graph_set_color(g, gg->read_iops, 0.13, 0.54, 0.13);
+       graph_set_color(g, gg->write_iops, 1.0, 0.0, 0.0);
        line_graph_set_data_count_limit(g, gfio_graph_limit);
        graph_add_extra_space(g, 0.0, 0.0, 0.0, 0.0);
-       return g;
+       graph_set_graph_all_zeroes(g, 0);
+       gg->bandwidth_graph = g;
 }
 
-static struct graph *setup_bandwidth_graph(void)
+static void setup_bandwidth_graph(struct gfio_graphs *gg)
 {
        struct graph *g;
 
        g = graph_new(DRAWING_AREA_XDIM / 2.0, DRAWING_AREA_YDIM, gfio_graph_font);
        graph_title(g, "Bandwidth (bytes/sec)");
        graph_x_title(g, "Time (secs)");
-       graph_add_label(g, "Read Bandwidth");
-       graph_add_label(g, "Write Bandwidth");
-       graph_set_color(g, "Read Bandwidth", 0.13, 0.54, 0.13);
-       graph_set_color(g, "Write Bandwidth", 1.0, 0.0, 0.0);
+       gg->read_bw = graph_add_label(g, "Read Bandwidth");
+       gg->write_bw = graph_add_label(g, "Write Bandwidth");
+       graph_set_color(g, gg->read_bw, 0.13, 0.54, 0.13);
+       graph_set_color(g, gg->write_bw, 1.0, 0.0, 0.0);
        graph_set_base_offset(g, 1);
        line_graph_set_data_count_limit(g, 100);
        graph_add_extra_space(g, 0.0, 0.0, 0.0, 0.0);
-       return g;
+       graph_set_graph_all_zeroes(g, 0);
+       gg->iops_graph = g;
 }
 
 static void setup_graphs(struct gfio_graphs *g)
 {
-       g->iops_graph = setup_iops_graph();
-       g->bandwidth_graph = setup_bandwidth_graph();
+       setup_iops_graph(g);
+       setup_bandwidth_graph(g);
 }
 
 void clear_ge_ui_info(struct gui_entry *ge)
@@ -810,6 +812,12 @@ static int do_file_open(struct gui_entry *ge, const gchar *uri)
 
        client = fio_client_add_explicit(&gfio_client_ops, ge->host, ge->type, ge->port);
        if (client) {
+               char *label = strdup(uri);
+
+               basename(label);
+               gtk_label_set_text(GTK_LABEL(ge->page_label), basename(label));
+               free(label);
+
                gfio_client_added(ge, client);
                file_add_recent(ge->ui, uri);
                return 0;
@@ -1383,7 +1391,7 @@ static GtkWidget *new_client_page(struct gui_entry *ge)
        gtk_container_add(GTK_CONTAINER(bottom_align), ge->buttonbox);
        gtk_box_pack_start(GTK_BOX(main_vbox), bottom_align, FALSE, FALSE, 0);
 
-       add_buttons(ge, buttonspeclist, ARRAYSIZE(buttonspeclist));
+       add_buttons(ge, buttonspeclist, ARRAY_SIZE(buttonspeclist));
 
        /*
         * Set up thread status progress bar