iowatcher: Merge branch 'jan'
authorChris Mason <chris.mason@fusionio.com>
Tue, 11 Sep 2012 01:01:02 +0000 (21:01 -0400)
committerChris Mason <chris.mason@oracle.com>
Tue, 11 Sep 2012 01:01:02 +0000 (21:01 -0400)
Jan Kara's updates for xzoom and yzoom

Conflicts:
main.c

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
1  2 
iowatcher/main.c

index a477f04b271fbdf8d386da7094e713c9036096cc,6d112be8fbacdc90552549f262d13a0ddf500462..e076f679836f12ce61154c6c8c13f58fea51398e
@@@ -50,9 -52,15 +52,16 @@@ static int opt_graph_width = 0
  static int opt_graph_height = 0;
  
  static int columns = 1;
--static int num_xticks = 9;
++static int num_xticks = 7;
 +static int num_yticks = 4;
  
+ static double min_time = 0;
+ static double max_time = DBL_MAX;
+ static unsigned long long min_mb = 0;
+ static unsigned long long max_mb = ULLONG_MAX >> 20;
+ int plot_io_action = 0;
  /*
   * this doesn't include the IO graph,
   * but it counts the other graphs as they go out
@@@ -559,8 -584,9 +585,9 @@@ static void plot_io(struct plot *plot, 
  
        set_plot_label(plot, "Device IO");
        set_ylabel(plot, "Offset (MB)");
-       set_yticks(plot, num_yticks, 0, max_offset / (1024 * 1024), "");
-       set_xticks(plot, num_xticks, 0, seconds);
 -      set_yticks(plot, 4, min_offset / (1024 * 1024),
++      set_yticks(plot, num_yticks, min_offset / (1024 * 1024),
+                  max_offset / (1024 * 1024), "");
+       set_xticks(plot, num_xticks, min_seconds, max_seconds);
  
        list_for_each_entry(tf, &all_traces, list) {
                char *label = tf->label;
@@@ -609,8 -635,8 +636,8 @@@ static void plot_tput(struct plot *plot
        scale_line_graph_bytes(&max, &units, 1024);
        sprintf(line, "%sB/s", units);
        set_ylabel(plot, line);
 -      set_yticks(plot, 4, 0, max, "");
 +      set_yticks(plot, num_yticks, 0, max, "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, min_seconds, max_seconds);
  
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->tput_gld, tf->read_color, 0, 0);
@@@ -659,17 -685,16 +686,18 @@@ static void plot_cpu(struct plot *plot
        setup_axis(plot);
        set_plot_label(plot, label);
  
-       seconds = tf->mpstat_seconds;
+       max_seconds = tf->mpstat_max_seconds;
  
 -      set_yticks(plot, 4, 0, tf->mpstat_gld[gld_index]->max, "");
 +      set_yticks(plot, num_yticks, 0, tf->mpstat_gld[gld_index]->max, "");
        set_ylabel(plot, "Percent");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, tf->mpstat_min_seconds, max_seconds);
  
        cpu_color_index = 0;
        list_for_each_entry(tf, &all_traces, list) {
-               for (i = 0; i < tf->mpstat_gld[0]->stop_seconds; i++) {
 +              if (tf->mpstat_gld == 0)
 +                      break;
+               for (i = tf->mpstat_gld[0]->min_seconds;
+                    i < tf->mpstat_gld[0]->stop_seconds; i++) {
                        if (tf->mpstat_gld[gld_index]->data[i].count) {
                                avg += (tf->mpstat_gld[gld_index]->data[i].sum /
                                        tf->mpstat_gld[gld_index]->data[i].count);
@@@ -739,8 -767,8 +770,8 @@@ static void plot_queue_depth(struct plo
  
        tf = list_entry(all_traces.next, struct trace_file, list);
        set_ylabel(plot, "Pending IO");
 -      set_yticks(plot, 4, 0, tf->queue_depth_gld->max, "");
 +      set_yticks(plot, num_yticks, 0, tf->queue_depth_gld->max, "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, min_seconds, max_seconds);
  
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->queue_depth_gld, tf->read_color, 0, 0);
@@@ -911,8 -939,8 +944,8 @@@ static void plot_latency(struct plot *p
        scale_line_graph_time(&max, &units);
        sprintf(line, "latency (%ss)", units);
        set_ylabel(plot, line);
 -      set_yticks(plot, 4, 0, max, "");
 +      set_yticks(plot, num_yticks, 0, max, "");
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, min_seconds, max_seconds);
  
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->latency_gld, tf->read_color, 0, 0);
@@@ -955,8 -983,8 +988,8 @@@ static void plot_iops(struct plot *plot
        scale_line_graph_bytes(&max, &units, 1000);
        set_ylabel(plot, "IO/s");
  
 -      set_yticks(plot, 4, 0, max, units);
 +      set_yticks(plot, num_yticks, 0, max, units);
-       set_xticks(plot, num_xticks, 0, seconds);
+       set_xticks(plot, num_xticks, min_seconds, max_seconds);
  
        list_for_each_entry(tf, &all_traces, list) {
                svg_line_graph(plot, tf->iop_gld, tf->read_color, 0, 0);
@@@ -1231,14 -1360,12 +1365,14 @@@ int main(int ac, char **av
                if (num_xticks < 2)
                        num_xticks = 2;
        }
 +      if (rows <= 50)
 +              num_yticks--;
  
        check_plot_columns(plot, TPUT_GRAPH_INDEX);
-       plot_tput(plot, seconds);
+       plot_tput(plot, min_seconds, max_seconds);
  
        check_plot_columns(plot, CPU_IO_GRAPH_INDEX);
-       plot_cpu(plot, seconds, "CPU IO Wait Time",
+       plot_cpu(plot, max_seconds, "CPU IO Wait Time",
                 CPU_IO_GRAPH_INDEX, MPSTAT_IO);
  
        check_plot_columns(plot, CPU_SYS_GRAPH_INDEX);