2 * Copyright (C) 2012 Fusion-io
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * Parts of this file were imported from Jens Axboe's blktrace sources (also GPL)
19 #include <sys/types.h>
28 #include <asm/types.h>
41 LIST_HEAD(all_traces);
43 static char line[1024];
44 static int line_len = 1024;
45 static int found_mpstat = 0;
46 static int cpu_color_index = 0;
47 static int color_index = 0;
48 static int make_movie = 0;
49 static int opt_graph_width = 0;
50 static int opt_graph_height = 0;
55 "orange", "darkviolet",
62 char *pick_color(void) {
63 char *ret = colors[color_index];
66 ret = colors[color_index];
72 char *pick_cpu_color(void) {
73 char *ret = colors[cpu_color_index];
76 ret = colors[cpu_color_index];
91 QUEUE_DEPTH_GRAPH_INDEX,
105 static char *graphs_by_name[] = {
118 static int active_graphs[TOTAL_GRAPHS];
119 static int last_active_graph = IOPS_GRAPH_INDEX;
121 static int label_index = 0;
122 static int num_traces = 0;
123 static int longest_label = 0;
126 struct list_head list;
137 struct graph_line_data *tput_gld;
138 struct graph_line_data *iop_gld;
139 struct graph_line_data *latency_gld;
140 struct graph_line_data *queue_depth_gld;
141 struct graph_dot_data *gdd_writes;
142 struct graph_dot_data *gdd_reads;
145 int mpstat_stop_seconds;
146 struct graph_line_data **mpstat_gld;
149 static void alloc_mpstat_gld(struct trace_file *tf)
151 struct graph_line_data **ptr;
153 if (tf->trace->mpstat_num_cpus == 0)
156 ptr = calloc((tf->trace->mpstat_num_cpus + 1) * MPSTAT_GRAPHS,
157 sizeof(struct graph_line_data *));
159 perror("Unable to allocate mpstat arrays\n");
162 tf->mpstat_gld = ptr;
165 static void enable_all_graphs(void)
168 for (i = 0; i < TOTAL_GRAPHS; i++)
169 active_graphs[i] = 1;
172 static void disable_all_graphs(void)
175 for (i = 0; i < TOTAL_GRAPHS; i++)
176 active_graphs[i] = 0;
179 static int enable_one_graph(char *name)
182 for (i = 0; i < TOTAL_GRAPHS; i++) {
183 if (strcmp(name, graphs_by_name[i]) == 0) {
184 active_graphs[i] = 1;
191 static int disable_one_graph(char *name)
194 for (i = 0; i < TOTAL_GRAPHS; i++) {
195 if (strcmp(name, graphs_by_name[i]) == 0) {
196 active_graphs[i] = 0;
203 static int last_graph(void)
206 for (i = TOTAL_GRAPHS - 1; i >= 0; i--) {
207 if (active_graphs[i]) {
213 static void add_trace_file(char *filename)
215 struct trace_file *tf;
217 tf = calloc(1, sizeof(*tf));
219 fprintf(stderr, "Unable to allocate memory\n");
223 tf->filename = strdup(filename);
224 list_add_tail(&tf->list, &all_traces);
225 tf->read_color = pick_color();
226 tf->write_color = pick_color();
230 static void setup_trace_file_graphs(void)
232 struct trace_file *tf;
235 list_for_each_entry(tf, &all_traces, list) {
236 tf->tput_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
237 tf->latency_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
238 tf->queue_depth_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
239 tf->iop_gld = alloc_line_data(tf->seconds, tf->stop_seconds);
240 tf->gdd_writes = alloc_dot_data(tf->seconds, tf->max_offset, tf->stop_seconds);
241 tf->gdd_reads = alloc_dot_data(tf->seconds, tf->max_offset, tf->stop_seconds);
243 if (tf->trace->mpstat_num_cpus == 0)
246 alloc_mpstat_gld(tf);
247 for (i = 0; i < (tf->trace->mpstat_num_cpus + 1) * MPSTAT_GRAPHS; i++) {
249 alloc_line_data(tf->mpstat_seconds,
251 tf->mpstat_gld[i]->max = 100;
256 static void read_traces(void)
258 struct trace_file *tf;
264 list_for_each_entry(tf, &all_traces, list) {
265 trace = open_trace(tf->filename);
269 last_time = find_last_time(trace);
271 tf->seconds = SECONDS(last_time);
272 tf->stop_seconds = SECONDS(last_time);
273 tf->max_offset = find_highest_offset(trace);
275 filter_outliers(trace, tf->max_offset, &ymin, &ymax);
276 tf->max_offset = ymax;
278 read_mpstat(trace, tf->filename);
279 tf->mpstat_stop_seconds = trace->mpstat_seconds;
280 tf->mpstat_seconds = trace->mpstat_seconds;
281 if (tf->mpstat_seconds)
286 static void read_trace_events(void)
289 struct trace_file *tf;
294 double user, sys, iowait, irq, soft;
295 double max_user = 0, max_sys = 0, max_iowait = 0,
296 max_irq = 0, max_soft = 0;
298 list_for_each_entry(tf, &all_traces, list) {
303 add_tput(trace, tf->tput_gld);
304 add_iop(trace, tf->iop_gld);
305 add_io(trace, tf->gdd_writes, tf->gdd_reads);
306 add_pending_io(trace, tf->queue_depth_gld);
307 add_completed_io(trace, tf->latency_gld);
308 ret = next_record(trace);
313 list_for_each_entry(tf, &all_traces, list) {
316 if (trace->mpstat_num_cpus == 0)
321 for (time = 0; time < tf->mpstat_stop_seconds; time ++) {
322 for (i = 0; i < (trace->mpstat_num_cpus + 1) * MPSTAT_GRAPHS; i += MPSTAT_GRAPHS) {
323 ret = read_mpstat_event(trace, &user, &sys,
324 &iowait, &irq, &soft);
327 if (next_mpstat_line(trace))
336 if (iowait > max_iowait)
339 add_mpstat_gld(time, sys, tf->mpstat_gld[i + MPSTAT_SYS]);
340 add_mpstat_gld(time, irq, tf->mpstat_gld[i + MPSTAT_IRQ]);
341 add_mpstat_gld(time, soft, tf->mpstat_gld[i + MPSTAT_SOFT]);
342 add_mpstat_gld(time, user, tf->mpstat_gld[i + MPSTAT_USER]);
343 add_mpstat_gld(time, iowait, tf->mpstat_gld[i + MPSTAT_IO]);
345 if (next_mpstat(trace) == NULL)
351 list_for_each_entry(tf, &all_traces, list) {
354 if (trace->mpstat_num_cpus == 0)
357 tf->mpstat_gld[MPSTAT_SYS]->max = max_sys;
358 tf->mpstat_gld[MPSTAT_IRQ]->max = max_irq;
359 tf->mpstat_gld[MPSTAT_SOFT]->max = max_soft;
360 tf->mpstat_gld[MPSTAT_USER]->max = max_user;
361 tf->mpstat_gld[MPSTAT_IO]->max = max_iowait;;
366 static void set_trace_label(char *label)
369 struct trace_file *tf;
370 int len = strlen(label);
372 if (len > longest_label)
375 list_for_each_entry(tf, &all_traces, list) {
376 if (cur == label_index) {
377 tf->label = strdup(label);
385 static char *graph_title = "";
386 static char *output_filename = "trace.svg";
387 static char *blktrace_device = NULL;
388 static char *blktrace_outfile = "trace";
389 static char *blktrace_dest_dir = ".";
390 static char *program_to_run = NULL;
392 static void set_blktrace_outfile(char *arg)
394 char *s = strdup(arg);
395 char *last_dot = strrchr(s, '.');
398 if (strcmp(last_dot, ".dump") == 0)
401 blktrace_outfile = s;
405 static void compare_max_tf(struct trace_file *tf, int *seconds, u64 *max_offset)
407 if (tf->seconds > *seconds)
408 *seconds = tf->seconds;
409 if (tf->max_offset > *max_offset)
410 *max_offset = tf->max_offset;
413 static void set_all_max_tf(int seconds, u64 max_offset)
415 struct trace_file *tf;
417 list_for_each_entry(tf, &all_traces, list) {
418 tf->seconds = seconds;
419 tf->max_offset = max_offset;
423 static char *create_movie_temp_dir(void)
426 char *pattern = strdup("btrfs-movie-XXXXXX");;
428 ret = mkdtemp(pattern);
430 perror("Unable to create temp directory for movie files");
436 static struct plot_history *alloc_plot_history(char *color)
438 struct plot_history *ph = calloc(1, sizeof(struct plot_history));
441 perror("memory allocation failed");
444 ph->history = calloc(4096, sizeof(double));
446 perror("memory allocation failed");
449 ph->history_len = 4096;
454 LIST_HEAD(movie_history_writes);
455 LIST_HEAD(movie_history_reads);
456 int num_histories = 0;
458 static void add_history(struct plot_history *ph, struct list_head *list)
460 struct plot_history *entry;
462 list_add_tail(&ph->list, list);
465 if (num_histories > 12) {
467 entry = list_entry(list->next, struct plot_history, list);
468 list_del(&entry->list);
469 free(entry->history);
474 static void plot_movie_history(struct plot *plot, struct list_head *list)
477 struct plot_history *ph;
479 list_for_each_entry(ph, list, list) {
480 if (ph->list.next == list)
482 svg_io_graph_movie_array(plot, ph, 1);
489 static void free_all_plot_history(struct list_head *head)
491 struct plot_history *entry;
492 while (!list_empty(head)) {
493 entry = list_entry(head->next, struct plot_history, list);
494 list_del(&entry->list);
495 free(entry->history);
500 static void __plot_io(struct plot *plot, int seconds, u64 max_offset)
502 struct trace_file *tf;
504 if (active_graphs[IO_GRAPH_INDEX] == 0)
509 svg_alloc_legend(plot, num_traces * 2);
511 set_plot_label(plot, "Device IO");
512 set_ylabel(plot, "Offset (MB)");
513 set_yticks(plot, 4, 0, max_offset / (1024 * 1024), "");
514 set_xticks(plot, 9, 0, seconds);
516 list_for_each_entry(tf, &all_traces, list) {
517 char *label = tf->label;
521 svg_io_graph(plot, tf->gdd_reads, tf->read_color);
522 if (tf->gdd_reads->total_ios)
523 svg_add_legend(plot, label, " Reads", tf->read_color);
525 svg_io_graph(plot, tf->gdd_writes, tf->write_color);
526 if (tf->gdd_writes->total_ios) {
527 svg_add_legend(plot, label, " Writes", tf->write_color);
530 if (plot->add_xlabel)
531 set_xlabel(plot, "Time (seconds)");
532 svg_write_legend(plot);
535 static void plot_io(struct plot *plot, int seconds, u64 max_offset)
537 plot->add_xlabel = last_active_graph == IO_GRAPH_INDEX;
539 __plot_io(plot, seconds, max_offset);
543 static void __plot_tput(struct plot *plot, int seconds)
545 struct trace_file *tf;
550 if (active_graphs[TPUT_GRAPH_INDEX] == 0)
554 svg_alloc_legend(plot, num_traces);
555 list_for_each_entry(tf, &all_traces, list) {
556 if (tf->tput_gld->max > max)
557 max = tf->tput_gld->max;
559 list_for_each_entry(tf, &all_traces, list)
560 tf->tput_gld->max = max;
563 set_plot_label(plot, "Throughput");
565 tf = list_entry(all_traces.next, struct trace_file, list);
567 scale_line_graph_bytes(&max, &units, 1024);
568 sprintf(line, "%sB/s", units);
569 set_ylabel(plot, line);
570 set_yticks(plot, 4, 0, max, "");
571 set_xticks(plot, 9, 0, seconds);
573 list_for_each_entry(tf, &all_traces, list) {
574 svg_line_graph(plot, tf->tput_gld, tf->read_color);
576 svg_add_legend(plot, tf->label, "", tf->read_color);
579 if (plot->add_xlabel)
580 set_xlabel(plot, "Time (seconds)");
582 svg_write_legend(plot);
585 static void plot_tput(struct plot *plot, int seconds)
587 plot->add_xlabel = last_active_graph == TPUT_GRAPH_INDEX;
588 __plot_tput(plot, seconds);
592 static void convert_movie_files(char *movie_dir)
594 fprintf(stderr, "Converting svg files in %s\n", movie_dir);
595 snprintf(line, line_len, "find %s -name \\*.svg | xargs -I{} -n 1 -P 8 rsvg-convert -o {}.png {}",
600 static void mencode_movie(char *movie_dir)
602 fprintf(stderr, "Creating movie %s\n", movie_dir);
603 snprintf(line, line_len, "mencoder mf://%s/*.png -mf type=png:fps=16 -of lavf "
604 "-ovc x264 -oac copy -o %s",
605 movie_dir, output_filename);
609 static void cleanup_movie(char *movie_dir)
611 fprintf(stderr, "Removing movie dir %s\n", movie_dir);
612 snprintf(line, line_len, "rm %s/*", movie_dir);
615 snprintf(line, line_len, "rmdir %s", movie_dir);
619 static void plot_io_movie(struct plot *plot)
621 struct trace_file *tf;
622 char *movie_dir = create_movie_temp_dir();
624 struct plot_history *read_history;
625 struct plot_history *write_history;
628 int movie_frames_per_sec = 16;
629 int total_frames = movie_len * movie_frames_per_sec;
633 get_graph_size(&cols, &rows);
634 batch_count = cols / total_frames;
636 if (batch_count == 0)
639 list_for_each_entry(tf, &all_traces, list) {
640 char *label = tf->label;
646 snprintf(line, line_len, "%s/%010d-%s.svg", movie_dir, i, output_filename);
647 set_plot_output(plot, line);
649 set_plot_title(plot, graph_title);
651 svg_alloc_legend(plot, num_traces * 2);
653 read_history = alloc_plot_history(tf->read_color);
654 write_history = alloc_plot_history(tf->write_color);
655 read_history->col = i;
656 write_history->col = i;
658 if (tf->gdd_reads->total_ios)
659 svg_add_legend(plot, label, " Reads", tf->read_color);
660 if (tf->gdd_writes->total_ios)
661 svg_add_legend(plot, label, " Writes", tf->write_color);
664 while (i < cols && batch_i < batch_count) {
665 /* print just this column */
666 svg_io_graph_movie(tf->gdd_reads, read_history, i);
668 svg_io_graph_movie(tf->gdd_writes, write_history, i);
673 add_history(read_history, &movie_history_reads);
674 add_history(write_history, &movie_history_writes);
676 plot_movie_history(plot, &movie_history_reads);
677 plot_movie_history(plot, &movie_history_writes);
679 svg_write_legend(plot);
682 set_graph_size(cols, rows / 3);
683 plot->add_xlabel = 1;
684 __plot_tput(plot, tf->gdd_reads->seconds);
685 svg_write_time_line(plot, i);
687 set_graph_size(cols, rows);
691 free_all_plot_history(&movie_history_reads);
692 free_all_plot_history(&movie_history_writes);
694 convert_movie_files(movie_dir);
695 mencode_movie(movie_dir);
696 cleanup_movie(movie_dir);
700 static void plot_cpu(struct plot *plot, int seconds, char *label,
701 int active_index, int gld_index)
703 struct trace_file *tf;
713 if (active_graphs[active_index] == 0)
716 list_for_each_entry(tf, &all_traces, list) {
717 if (tf->trace->mpstat_num_cpus > max)
718 max = tf->trace->mpstat_num_cpus;
723 tf = list_entry(all_traces.next, struct trace_file, list);
725 ymax = tf->mpstat_gld[gld_index]->max;
729 svg_alloc_legend(plot, num_traces * max);
731 plot->add_xlabel = last_active_graph == active_index;
733 set_plot_label(plot, label);
735 seconds = tf->mpstat_seconds;
737 set_yticks(plot, 4, 0, tf->mpstat_gld[gld_index]->max, "");
738 set_ylabel(plot, "Percent");
739 set_xticks(plot, 9, 0, seconds);
742 list_for_each_entry(tf, &all_traces, list) {
743 for (i = 0; i < tf->mpstat_gld[0]->stop_seconds; i++) {
744 avg += tf->mpstat_gld[gld_index]->data[i].sum;
746 avg /= tf->mpstat_gld[gld_index]->stop_seconds;
747 color = pick_cpu_color();
748 svg_line_graph(plot, tf->mpstat_gld[0], color);
749 svg_add_legend(plot, tf->label, " avg", color);
751 for (i = 1; i < tf->trace->mpstat_num_cpus + 1; i++) {
752 struct graph_line_data *gld = tf->mpstat_gld[i * MPSTAT_GRAPHS + gld_index];
755 for (gld_i = 0; gld_i < gld->stop_seconds; gld_i++)
756 this_avg += gld->data[i].sum;
758 this_avg /= gld->stop_seconds;
760 for (gld_i = 0; gld_i < gld->stop_seconds; gld_i++) {
761 if (this_avg > avg + 30 ||
762 gld->data[gld_i].sum > 95) {
763 color = pick_cpu_color();
764 svg_line_graph(plot, gld, color);
765 snprintf(line, 128, " CPU %d\n", i - 1);
766 svg_add_legend(plot, tf->label, line, color);
775 if (plot->add_xlabel)
776 set_xlabel(plot, "Time (seconds)");
778 if (plot->legend_index <= 8)
779 svg_write_legend(plot);
781 svg_free_legend(plot);
785 static void plot_latency(struct plot *plot, int seconds)
787 struct trace_file *tf;
792 if (active_graphs[LATENCY_GRAPH_INDEX] == 0)
796 svg_alloc_legend(plot, num_traces);
797 list_for_each_entry(tf, &all_traces, list) {
798 if (tf->latency_gld->max > max)
799 max = tf->latency_gld->max;
801 list_for_each_entry(tf, &all_traces, list)
802 tf->latency_gld->max = max;
804 plot->add_xlabel = last_active_graph == TPUT_GRAPH_INDEX;
806 set_plot_label(plot, "IO Latency");
808 tf = list_entry(all_traces.next, struct trace_file, list);
810 scale_line_graph_time(&max, &units);
811 sprintf(line, "latency (%ss)", units);
812 set_ylabel(plot, line);
813 set_yticks(plot, 4, 0, max, "");
814 set_xticks(plot, 9, 0, seconds);
816 list_for_each_entry(tf, &all_traces, list) {
817 svg_line_graph(plot, tf->latency_gld, tf->read_color);
819 svg_add_legend(plot, tf->label, "", tf->read_color);
822 if (plot->add_xlabel)
823 set_xlabel(plot, "Time (seconds)");
825 svg_write_legend(plot);
829 static void plot_queue_depth(struct plot *plot, int seconds)
831 struct trace_file *tf;
833 if (active_graphs[QUEUE_DEPTH_GRAPH_INDEX] == 0)
836 plot->add_xlabel = last_active_graph == QUEUE_DEPTH_GRAPH_INDEX;
839 set_plot_label(plot, "Queue Depth");
841 svg_alloc_legend(plot, num_traces);
843 tf = list_entry(all_traces.next, struct trace_file, list);
844 set_ylabel(plot, "Pending IO");
845 set_yticks(plot, 4, 0, tf->queue_depth_gld->max, "");
846 set_xticks(plot, 9, 0, seconds);
848 list_for_each_entry(tf, &all_traces, list) {
849 svg_line_graph(plot, tf->queue_depth_gld, tf->read_color);
851 svg_add_legend(plot, tf->label, "", tf->read_color);
854 if (plot->add_xlabel)
855 set_xlabel(plot, "Time (seconds)");
857 svg_write_legend(plot);
861 static void plot_iops(struct plot *plot, int seconds)
863 struct trace_file *tf;
867 if (active_graphs[IOPS_GRAPH_INDEX] == 0)
870 list_for_each_entry(tf, &all_traces, list) {
871 if (tf->iop_gld->max > max)
872 max = tf->iop_gld->max;
875 list_for_each_entry(tf, &all_traces, list)
876 tf->iop_gld->max = max;
879 plot->add_xlabel = last_active_graph == IOPS_GRAPH_INDEX;
881 set_plot_label(plot, "IOPs");
883 svg_alloc_legend(plot, num_traces);
885 tf = list_entry(all_traces.next, struct trace_file, list);
887 scale_line_graph_bytes(&max, &units, 1000);
888 set_ylabel(plot, "IO/s");
890 set_yticks(plot, 4, 0, max, units);
891 set_xticks(plot, 9, 0, seconds);
893 list_for_each_entry(tf, &all_traces, list) {
894 svg_line_graph(plot, tf->iop_gld, tf->read_color);
896 svg_add_legend(plot, tf->label, "", tf->read_color);
899 if (plot->add_xlabel)
900 set_xlabel(plot, "Time (seconds)");
902 svg_write_legend(plot);
911 char *option_string = "T:t:o:l:r:O:N:d:p:mh:w:";
912 static struct option long_options[] = {
913 {"title", required_argument, 0, 'T'},
914 {"trace", required_argument, 0, 't'},
915 {"output", required_argument, 0, 'o'},
916 {"label", required_argument, 0, 'l'},
917 {"rolling", required_argument, 0, 'r'},
918 {"no-graph", required_argument, 0, 'N'},
919 {"only-graph", required_argument, 0, 'O'},
920 {"device", required_argument, 0, 'd'},
921 {"prog", required_argument, 0, 'p'},
922 {"movie", no_argument, 0, 'm'},
923 {"width", required_argument, 0, 'w'},
924 {"height", required_argument, 0, 'h'},
925 {"help", required_argument, 0, HELP_LONG_OPT},
929 static void print_usage(void)
931 fprintf(stderr, "iowatcher usage:\n"
932 "\t-d (--device): device for blktrace to trace\n"
933 "\t-t (--trace): trace file name (more than one allowed)\n"
934 "\t-l (--label): trace label in the graph\n"
935 "\t-o (--output): output file name (SVG only)\n"
936 "\t-p (--prog): program to run while blktrace is run\n"
937 "\t-p (--movie): create IO animations\n"
938 "\t-r (--rolling): number of seconds in the rolling averge\n"
939 "\t-T (--title): graph title\n"
940 "\t-N (--no-graph): skip a single graph (io, tput, latency, queue_depth, iops)\n"
941 "\t-h (--height): set the height of each graph\n"
942 "\t-w (--width): set the width of each graph\n"
947 static int parse_options(int ac, char **av)
953 // int this_option_optind = optind ? optind : 1;
954 int option_index = 0;
956 c = getopt_long(ac, av, option_string,
957 long_options, &option_index);
964 graph_title = strdup(optarg);
967 add_trace_file(optarg);
968 set_blktrace_outfile(optarg);
971 output_filename = strdup(optarg);
974 set_trace_label(optarg);
977 set_rolling_avg(atoi(optarg));
981 disable_all_graphs();
984 enable_one_graph(optarg);
987 disable_one_graph(optarg);
990 blktrace_device = strdup(optarg);
993 program_to_run = strdup(optarg);
999 opt_graph_height = atoi(optarg);
1002 opt_graph_width = atoi(optarg);
1016 int main(int ac, char **av)
1021 struct trace_file *tf;
1024 init_io_hash_table();
1026 enable_all_graphs();
1028 parse_options(ac, av);
1030 last_active_graph = last_graph();
1032 set_io_graph_scale(256);
1033 set_graph_size(700, 250);
1035 if (opt_graph_height)
1036 set_graph_height(opt_graph_height);
1038 if (opt_graph_width)
1039 set_graph_width(opt_graph_height);
1041 if (list_empty(&all_traces)) {
1042 fprintf(stderr, "No traces found, exiting\n");
1046 if (blktrace_device) {
1047 ret = start_blktrace(blktrace_device, blktrace_outfile,
1050 fprintf(stderr, "exiting due to blktrace failure\n");
1053 start_mpstat(blktrace_outfile);
1054 if (program_to_run) {
1055 ret = run_program(program_to_run);
1057 fprintf(stderr, "failed to run %s\n",
1062 blktrace_to_dump(blktrace_outfile);
1064 /* no program specified, just wait for
1071 /* step one, read all the traces */
1074 /* step two, find the maxes for time and offset */
1075 list_for_each_entry(tf, &all_traces, list)
1076 compare_max_tf(tf, &seconds, &max_offset);
1078 /* push the max we found into all the tfs */
1079 set_all_max_tf(seconds, max_offset);
1081 /* alloc graphing structs for all the traces */
1082 setup_trace_file_graphs();
1084 /* run through all the traces and read their events */
1085 read_trace_events();
1087 plot = alloc_plot();
1090 plot_io_movie(plot);
1094 set_plot_output(plot, output_filename);
1096 if (active_graphs[IO_GRAPH_INDEX] || found_mpstat)
1097 set_legend_width(longest_label + strlen("writes"));
1098 else if (num_traces > 1)
1099 set_legend_width(longest_label);
1101 set_legend_width(0);
1104 plot_io(plot, seconds, max_offset);
1105 plot_tput(plot, seconds);
1106 plot_cpu(plot, seconds, "CPU IO Wait Time",
1107 CPU_IO_GRAPH_INDEX, MPSTAT_IO);
1108 plot_cpu(plot, seconds, "CPU System Time",
1109 CPU_SYS_GRAPH_INDEX, MPSTAT_SYS);
1110 plot_cpu(plot, seconds, "CPU IRQ Time",
1111 CPU_IRQ_GRAPH_INDEX, MPSTAT_IRQ);
1112 plot_cpu(plot, seconds, "CPU SoftIRQ Time",
1113 CPU_SOFT_GRAPH_INDEX, MPSTAT_SOFT);
1114 plot_cpu(plot, seconds, "CPU User Time",
1115 CPU_USER_GRAPH_INDEX, MPSTAT_USER);
1117 plot_latency(plot, seconds);
1118 plot_queue_depth(plot, seconds);
1119 plot_iops(plot, seconds);