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, "ffmpeg -r 25 -y -i %s/%%10d-%s.svg.png -b:v 250k "
604 "-vcodec libx264 %s", movie_dir, output_filename, output_filename);
608 static void cleanup_movie(char *movie_dir)
610 fprintf(stderr, "Removing movie dir %s\n", movie_dir);
611 snprintf(line, line_len, "rm %s/*", movie_dir);
614 snprintf(line, line_len, "rmdir %s", movie_dir);
618 static void plot_io_movie(struct plot *plot)
620 struct trace_file *tf;
621 char *movie_dir = create_movie_temp_dir();
623 struct plot_history *read_history;
624 struct plot_history *write_history;
627 int movie_frames_per_sec = 16;
628 int total_frames = movie_len * movie_frames_per_sec;
632 get_graph_size(&cols, &rows);
633 batch_count = cols / total_frames;
635 if (batch_count == 0)
638 list_for_each_entry(tf, &all_traces, list) {
639 char *label = tf->label;
645 snprintf(line, line_len, "%s/%010d-%s.svg", movie_dir, i, output_filename);
646 set_plot_output(plot, line);
648 set_plot_title(plot, graph_title);
650 svg_alloc_legend(plot, num_traces * 2);
652 read_history = alloc_plot_history(tf->read_color);
653 write_history = alloc_plot_history(tf->write_color);
654 read_history->col = i;
655 write_history->col = i;
657 if (tf->gdd_reads->total_ios)
658 svg_add_legend(plot, label, " Reads", tf->read_color);
659 if (tf->gdd_writes->total_ios)
660 svg_add_legend(plot, label, " Writes", tf->write_color);
663 while (i < cols && batch_i < batch_count) {
664 /* print just this column */
665 svg_io_graph_movie(tf->gdd_reads, read_history, i);
667 svg_io_graph_movie(tf->gdd_writes, write_history, i);
672 add_history(read_history, &movie_history_reads);
673 add_history(write_history, &movie_history_writes);
675 plot_movie_history(plot, &movie_history_reads);
676 plot_movie_history(plot, &movie_history_writes);
678 svg_write_legend(plot);
681 set_graph_size(cols, rows / 3);
682 plot->add_xlabel = 1;
683 __plot_tput(plot, tf->gdd_reads->seconds);
684 svg_write_time_line(plot, i);
686 set_graph_size(cols, rows);
690 free_all_plot_history(&movie_history_reads);
691 free_all_plot_history(&movie_history_writes);
693 convert_movie_files(movie_dir);
694 mencode_movie(movie_dir);
695 cleanup_movie(movie_dir);
699 static void plot_cpu(struct plot *plot, int seconds, char *label,
700 int active_index, int gld_index)
702 struct trace_file *tf;
712 if (active_graphs[active_index] == 0)
715 list_for_each_entry(tf, &all_traces, list) {
716 if (tf->trace->mpstat_num_cpus > max)
717 max = tf->trace->mpstat_num_cpus;
722 tf = list_entry(all_traces.next, struct trace_file, list);
724 ymax = tf->mpstat_gld[gld_index]->max;
728 svg_alloc_legend(plot, num_traces * max);
730 plot->add_xlabel = last_active_graph == active_index;
732 set_plot_label(plot, label);
734 seconds = tf->mpstat_seconds;
736 set_yticks(plot, 4, 0, tf->mpstat_gld[gld_index]->max, "");
737 set_ylabel(plot, "Percent");
738 set_xticks(plot, 9, 0, seconds);
741 list_for_each_entry(tf, &all_traces, list) {
742 for (i = 0; i < tf->mpstat_gld[0]->stop_seconds; i++) {
743 avg += tf->mpstat_gld[gld_index]->data[i].sum;
745 avg /= tf->mpstat_gld[gld_index]->stop_seconds;
746 color = pick_cpu_color();
747 svg_line_graph(plot, tf->mpstat_gld[0], color);
748 svg_add_legend(plot, tf->label, " avg", color);
750 for (i = 1; i < tf->trace->mpstat_num_cpus + 1; i++) {
751 struct graph_line_data *gld = tf->mpstat_gld[i * MPSTAT_GRAPHS + gld_index];
754 for (gld_i = 0; gld_i < gld->stop_seconds; gld_i++)
755 this_avg += gld->data[i].sum;
757 this_avg /= gld->stop_seconds;
759 for (gld_i = 0; gld_i < gld->stop_seconds; gld_i++) {
760 if (this_avg > avg + 30 ||
761 gld->data[gld_i].sum > 95) {
762 color = pick_cpu_color();
763 svg_line_graph(plot, gld, color);
764 snprintf(line, 128, " CPU %d\n", i - 1);
765 svg_add_legend(plot, tf->label, line, color);
774 if (plot->add_xlabel)
775 set_xlabel(plot, "Time (seconds)");
777 if (plot->legend_index <= 8)
778 svg_write_legend(plot);
780 svg_free_legend(plot);
784 static void plot_latency(struct plot *plot, int seconds)
786 struct trace_file *tf;
791 if (active_graphs[LATENCY_GRAPH_INDEX] == 0)
795 svg_alloc_legend(plot, num_traces);
796 list_for_each_entry(tf, &all_traces, list) {
797 if (tf->latency_gld->max > max)
798 max = tf->latency_gld->max;
800 list_for_each_entry(tf, &all_traces, list)
801 tf->latency_gld->max = max;
803 plot->add_xlabel = last_active_graph == TPUT_GRAPH_INDEX;
805 set_plot_label(plot, "IO Latency");
807 tf = list_entry(all_traces.next, struct trace_file, list);
809 scale_line_graph_time(&max, &units);
810 sprintf(line, "latency (%ss)", units);
811 set_ylabel(plot, line);
812 set_yticks(plot, 4, 0, max, "");
813 set_xticks(plot, 9, 0, seconds);
815 list_for_each_entry(tf, &all_traces, list) {
816 svg_line_graph(plot, tf->latency_gld, tf->read_color);
818 svg_add_legend(plot, tf->label, "", tf->read_color);
821 if (plot->add_xlabel)
822 set_xlabel(plot, "Time (seconds)");
824 svg_write_legend(plot);
828 static void plot_queue_depth(struct plot *plot, int seconds)
830 struct trace_file *tf;
832 if (active_graphs[QUEUE_DEPTH_GRAPH_INDEX] == 0)
835 plot->add_xlabel = last_active_graph == QUEUE_DEPTH_GRAPH_INDEX;
838 set_plot_label(plot, "Queue Depth");
840 svg_alloc_legend(plot, num_traces);
842 tf = list_entry(all_traces.next, struct trace_file, list);
843 set_ylabel(plot, "Pending IO");
844 set_yticks(plot, 4, 0, tf->queue_depth_gld->max, "");
845 set_xticks(plot, 9, 0, seconds);
847 list_for_each_entry(tf, &all_traces, list) {
848 svg_line_graph(plot, tf->queue_depth_gld, tf->read_color);
850 svg_add_legend(plot, tf->label, "", tf->read_color);
853 if (plot->add_xlabel)
854 set_xlabel(plot, "Time (seconds)");
856 svg_write_legend(plot);
860 static void plot_iops(struct plot *plot, int seconds)
862 struct trace_file *tf;
866 if (active_graphs[IOPS_GRAPH_INDEX] == 0)
869 list_for_each_entry(tf, &all_traces, list) {
870 if (tf->iop_gld->max > max)
871 max = tf->iop_gld->max;
874 list_for_each_entry(tf, &all_traces, list)
875 tf->iop_gld->max = max;
878 plot->add_xlabel = last_active_graph == IOPS_GRAPH_INDEX;
880 set_plot_label(plot, "IOPs");
882 svg_alloc_legend(plot, num_traces);
884 tf = list_entry(all_traces.next, struct trace_file, list);
886 scale_line_graph_bytes(&max, &units, 1000);
887 set_ylabel(plot, "IO/s");
889 set_yticks(plot, 4, 0, max, units);
890 set_xticks(plot, 9, 0, seconds);
892 list_for_each_entry(tf, &all_traces, list) {
893 svg_line_graph(plot, tf->iop_gld, tf->read_color);
895 svg_add_legend(plot, tf->label, "", tf->read_color);
898 if (plot->add_xlabel)
899 set_xlabel(plot, "Time (seconds)");
901 svg_write_legend(plot);
910 char *option_string = "T:t:o:l:r:O:N:d:p:mh:w:";
911 static struct option long_options[] = {
912 {"title", required_argument, 0, 'T'},
913 {"trace", required_argument, 0, 't'},
914 {"output", required_argument, 0, 'o'},
915 {"label", required_argument, 0, 'l'},
916 {"rolling", required_argument, 0, 'r'},
917 {"no-graph", required_argument, 0, 'N'},
918 {"only-graph", required_argument, 0, 'O'},
919 {"device", required_argument, 0, 'd'},
920 {"prog", required_argument, 0, 'p'},
921 {"movie", no_argument, 0, 'm'},
922 {"width", required_argument, 0, 'w'},
923 {"height", required_argument, 0, 'h'},
924 {"help", no_argument, 0, HELP_LONG_OPT},
928 static void print_usage(void)
930 fprintf(stderr, "iowatcher usage:\n"
931 "\t-d (--device): device for blktrace to trace\n"
932 "\t-t (--trace): trace file name (more than one allowed)\n"
933 "\t-l (--label): trace label in the graph\n"
934 "\t-o (--output): output file name (SVG only)\n"
935 "\t-p (--prog): program to run while blktrace is run\n"
936 "\t-p (--movie): create IO animations\n"
937 "\t-r (--rolling): number of seconds in the rolling averge\n"
938 "\t-T (--title): graph title\n"
939 "\t-N (--no-graph): skip a single graph (io, tput, latency, queue_depth, iops)\n"
940 "\t-h (--height): set the height of each graph\n"
941 "\t-w (--width): set the width of each graph\n"
946 static int parse_options(int ac, char **av)
952 // int this_option_optind = optind ? optind : 1;
953 int option_index = 0;
955 c = getopt_long(ac, av, option_string,
956 long_options, &option_index);
963 graph_title = strdup(optarg);
966 add_trace_file(optarg);
967 set_blktrace_outfile(optarg);
970 output_filename = strdup(optarg);
973 set_trace_label(optarg);
976 set_rolling_avg(atoi(optarg));
980 disable_all_graphs();
983 enable_one_graph(optarg);
986 disable_one_graph(optarg);
989 blktrace_device = strdup(optarg);
992 program_to_run = strdup(optarg);
998 opt_graph_height = atoi(optarg);
1001 opt_graph_width = atoi(optarg);
1015 int main(int ac, char **av)
1020 struct trace_file *tf;
1023 init_io_hash_table();
1025 enable_all_graphs();
1027 parse_options(ac, av);
1029 last_active_graph = last_graph();
1031 set_io_graph_scale(256);
1032 set_graph_size(700, 250);
1034 if (opt_graph_height)
1035 set_graph_height(opt_graph_height);
1037 if (opt_graph_width)
1038 set_graph_width(opt_graph_height);
1040 if (list_empty(&all_traces)) {
1041 fprintf(stderr, "No traces found, exiting\n");
1045 if (blktrace_device) {
1046 ret = start_blktrace(blktrace_device, blktrace_outfile,
1049 fprintf(stderr, "exiting due to blktrace failure\n");
1052 start_mpstat(blktrace_outfile);
1053 if (program_to_run) {
1054 ret = run_program(program_to_run);
1056 fprintf(stderr, "failed to run %s\n",
1061 blktrace_to_dump(blktrace_outfile);
1063 /* no program specified, just wait for
1070 /* step one, read all the traces */
1073 /* step two, find the maxes for time and offset */
1074 list_for_each_entry(tf, &all_traces, list)
1075 compare_max_tf(tf, &seconds, &max_offset);
1077 /* push the max we found into all the tfs */
1078 set_all_max_tf(seconds, max_offset);
1080 /* alloc graphing structs for all the traces */
1081 setup_trace_file_graphs();
1083 /* run through all the traces and read their events */
1084 read_trace_events();
1086 plot = alloc_plot();
1089 plot_io_movie(plot);
1093 set_plot_output(plot, output_filename);
1095 if (active_graphs[IO_GRAPH_INDEX] || found_mpstat)
1096 set_legend_width(longest_label + strlen("writes"));
1097 else if (num_traces > 1)
1098 set_legend_width(longest_label);
1100 set_legend_width(0);
1102 set_plot_title(plot, graph_title);
1103 plot_io(plot, seconds, max_offset);
1104 plot_tput(plot, seconds);
1105 plot_cpu(plot, seconds, "CPU IO Wait Time",
1106 CPU_IO_GRAPH_INDEX, MPSTAT_IO);
1107 plot_cpu(plot, seconds, "CPU System Time",
1108 CPU_SYS_GRAPH_INDEX, MPSTAT_SYS);
1109 plot_cpu(plot, seconds, "CPU IRQ Time",
1110 CPU_IRQ_GRAPH_INDEX, MPSTAT_IRQ);
1111 plot_cpu(plot, seconds, "CPU SoftIRQ Time",
1112 CPU_SOFT_GRAPH_INDEX, MPSTAT_SOFT);
1113 plot_cpu(plot, seconds, "CPU User Time",
1114 CPU_USER_GRAPH_INDEX, MPSTAT_USER);
1116 plot_latency(plot, seconds);
1117 plot_queue_depth(plot, seconds);
1118 plot_iops(plot, seconds);