struct trace_file *tf;
char *units;
char line[128];
- u64 max = 0;
+ u64 max = 0, val;
if (active_graphs[TPUT_GRAPH_INDEX] == 0)
return;
svg_alloc_legend(plot, num_traces * 2);
list_for_each_entry(tf, &all_traces, list) {
- if (tf->tput_writes_gld->max > max)
- max = tf->tput_writes_gld->max;
- if (tf->tput_reads_gld->max > max)
- max = tf->tput_reads_gld->max;
+ val = line_graph_roll_avg_max(tf->tput_writes_gld);
+ if (val > max)
+ max = val;
+ val = line_graph_roll_avg_max(tf->tput_reads_gld);
+ if (val > max)
+ max = val;
}
list_for_each_entry(tf, &all_traces, list) {
if (tf->tput_writes_gld->max > 0)
struct trace_file *tf;
char *units;
char line[128];
- u64 max = 0;
+ u64 max = 0, val;
if (num_fio_traces == 0 || active_graphs[FIO_GRAPH_INDEX] == 0)
return;
svg_alloc_legend(plot, num_fio_traces);
list_for_each_entry(tf, &fio_traces, list) {
- if (tf->fio_gld->max > max)
- max = tf->fio_gld->max;
+ val = line_graph_roll_avg_max(tf->fio_gld);
+ if (val > max)
+ max = val;
}
list_for_each_entry(tf, &fio_traces, list) {
struct trace_file *tf;
char *units;
char line[128];
- u64 max = 0;
+ u64 max = 0, val;
if (active_graphs[LATENCY_GRAPH_INDEX] == 0)
return;
svg_alloc_legend(plot, num_traces);
list_for_each_entry(tf, &all_traces, list) {
- if (tf->latency_gld->max > max)
- max = tf->latency_gld->max;
+ val = line_graph_roll_avg_max(tf->latency_gld);
+ if (val > max)
+ max = val;
}
list_for_each_entry(tf, &all_traces, list)
{
struct trace_file *tf;
char *units;
- u64 max = 0;
+ u64 max = 0, val;
if (active_graphs[IOPS_GRAPH_INDEX] == 0)
return;
list_for_each_entry(tf, &all_traces, list) {
- if (tf->iop_gld->max > max)
- max = tf->iop_gld->max;
+ val = line_graph_roll_avg_max(tf->iop_gld);
+ if (val > max)
+ max = val;
}
list_for_each_entry(tf, &all_traces, list)
*max /= div;
}
+static int rolling_span(struct graph_line_data *gld)
+{
+ if (rolling_avg_secs)
+ return rolling_avg_secs;
+ return (gld->stop_seconds - gld->min_seconds) / 25;
+}
+
+
+double line_graph_roll_avg_max(struct graph_line_data *gld)
+{
+ unsigned int i;
+ int rolling;
+ double avg, max = 0;
+
+ rolling = rolling_span(gld);
+ for (i = gld->min_seconds; i < gld->stop_seconds; i++) {
+ avg = rolling_avg(gld->data, i, rolling);
+ if (avg > max)
+ max = avg;
+ }
+ return max;
+}
+
int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color, int thresh1, int thresh2)
{
unsigned int i;
if (thresh1 && thresh2)
rolling = 0;
- else if (rolling_avg_secs)
- rolling = rolling_avg_secs;
else
- rolling = (gld->stop_seconds - gld->min_seconds) / 25;
+ rolling = rolling_span(gld);
for (i = gld->min_seconds; i < gld->stop_seconds; i++) {
avg = rolling_avg(gld->data, i, rolling);
x = (double)(i - gld->min_seconds) / xscale;
if (!thresh1 && !thresh2) {
-
if (!printed_header) {
write_check(fd, start, strlen(start));
printed_header = 1;
char *pick_cpu_color(void);
void reset_cpu_color(void);
int svg_io_graph(struct plot *plot, struct graph_dot_data *gdd);
+double line_graph_roll_avg_max(struct graph_line_data *gld);
int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color, int thresh1, int thresh2);
struct graph_line_data *alloc_line_data(unsigned int min_seconds, unsigned int max_seconds, unsigned int stop_seconds);
struct graph_dot_data *alloc_dot_data(unsigned int min_seconds, unsigned int max_seconds, u64 min_offset, u64 max_offset, unsigned int stop_seconds, char *color, char *label);