gfio: graphing updates

- Don't draw tickmark labels for an empty graph
- Remove Y-axis label. It was a bit awkward and hard to read.
- Ensure that we always put proper units on the Y-axis graph.
- Ensure that we always include the top most Y-axis tickmark
  and make that the ceiling, not the highest Y value. It's hard
  to visually understand a graph that is drawing somewhere above
  the last labeled tickmark.
- Fix rounding errors in graph.c

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/gfio.c b/gfio.c
index d0418a4..fc220f5 100644
--- a/gfio.c
+++ b/gfio.c
@@ -187,70 +187,36 @@
 static void gfio_update_thread_status_all(char *status_message, double perc);
 void report_error(GError *error);
 
-static void iops_graph_y_axis_unit_change(struct graph *g, int power_of_ten)
-{
-	switch (power_of_ten) {
-		case 9: graph_y_title(g, "Billions of IOs / sec");
-			break;
-		case 6: graph_y_title(g, "Millions of IOs / sec");
-			break;
-		case 3: graph_y_title(g, "Thousands of IOs / sec");
-			break;
-		case 0:
-		default: graph_y_title(g, "IOs / sec");
-			break;
-	}
-}
-
 static struct graph *setup_iops_graph(void)
 {
 	struct graph *g;
 
 	g = graph_new(DRAWING_AREA_XDIM / 2.0, DRAWING_AREA_YDIM, gfio_graph_font);
-	graph_title(g, "IOPS");
+	graph_title(g, "IOPS (IOs/sec)");
 	graph_x_title(g, "Time (secs)");
-	graph_y_title(g, "IOs / sec");
 	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);
 	line_graph_set_data_count_limit(g, gfio_graph_limit);
-	graph_y_axis_unit_change_notify(g, iops_graph_y_axis_unit_change);
-	graph_add_extra_space(g, 0.005, 0.005, 0.03, 0.03);
+	graph_add_extra_space(g, 0.0, 0.0, 0.0, 0.0);
 	return g;
 }
 
-static void bandwidth_graph_y_axis_unit_change(struct graph *g, int power_of_ten)
-{
-	switch (power_of_ten) {
-		case 9: graph_y_title(g, "Petabytes / sec");
-			break;
-		case 6: graph_y_title(g, "Gigabytes / sec");
-			break;
-		case 3: graph_y_title(g, "Megabytes / sec");
-			break;
-		case 0:
-		default: graph_y_title(g, "Kilobytes / sec");
-			break;
-	}
-}
-
 static struct graph *setup_bandwidth_graph(void)
 {
 	struct graph *g;
 
 	g = graph_new(DRAWING_AREA_XDIM / 2.0, DRAWING_AREA_YDIM, gfio_graph_font);
-	graph_title(g, "Bandwidth");
+	graph_title(g, "Bandwidth (bytes/sec)");
 	graph_x_title(g, "Time (secs)");
-	graph_y_title(g, "Kbytes / sec");
 	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);
+	graph_set_base_offset(g, 1);
 	line_graph_set_data_count_limit(g, 100);
-	graph_y_axis_unit_change_notify(g, bandwidth_graph_y_axis_unit_change);
-	graph_add_extra_space(g, 0.005, 0.005, 0.03, 0.03);
-
+	graph_add_extra_space(g, 0.0, 0.0, 0.0, 0.0);
 	return g;
 }