|
@@ -545,6 +545,42 @@ hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right,
|
|
return __hist_entry__cmp_compute(p_left, p_right, c);
|
|
return __hist_entry__cmp_compute(p_left, p_right, c);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_nop(struct hist_entry *left __maybe_unused,
|
|
|
|
+ struct hist_entry *right __maybe_unused)
|
|
|
|
+{
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_baseline(struct hist_entry *left, struct hist_entry *right)
|
|
|
|
+{
|
|
|
|
+ if (sort_compute)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ if (left->stat.period == right->stat.period)
|
|
|
|
+ return 0;
|
|
|
|
+ return left->stat.period > right->stat.period ? 1 : -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_delta(struct hist_entry *left, struct hist_entry *right)
|
|
|
|
+{
|
|
|
|
+ return hist_entry__cmp_compute(right, left, COMPUTE_DELTA);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_ratio(struct hist_entry *left, struct hist_entry *right)
|
|
|
|
+{
|
|
|
|
+ return hist_entry__cmp_compute(right, left, COMPUTE_RATIO);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_wdiff(struct hist_entry *left, struct hist_entry *right)
|
|
|
|
+{
|
|
|
|
+ return hist_entry__cmp_compute(right, left, COMPUTE_WEIGHTED_DIFF);
|
|
|
|
+}
|
|
|
|
+
|
|
static void insert_hist_entry_by_compute(struct rb_root *root,
|
|
static void insert_hist_entry_by_compute(struct rb_root *root,
|
|
struct hist_entry *he,
|
|
struct hist_entry *he,
|
|
int c)
|
|
int c)
|
|
@@ -1038,27 +1074,35 @@ static void data__hpp_register(struct data__file *d, int idx)
|
|
fmt->header = hpp__header;
|
|
fmt->header = hpp__header;
|
|
fmt->width = hpp__width;
|
|
fmt->width = hpp__width;
|
|
fmt->entry = hpp__entry_global;
|
|
fmt->entry = hpp__entry_global;
|
|
|
|
+ fmt->cmp = hist_entry__cmp_nop;
|
|
|
|
+ fmt->collapse = hist_entry__cmp_nop;
|
|
|
|
|
|
/* TODO more colors */
|
|
/* TODO more colors */
|
|
switch (idx) {
|
|
switch (idx) {
|
|
case PERF_HPP_DIFF__BASELINE:
|
|
case PERF_HPP_DIFF__BASELINE:
|
|
fmt->color = hpp__color_baseline;
|
|
fmt->color = hpp__color_baseline;
|
|
|
|
+ fmt->sort = hist_entry__cmp_baseline;
|
|
break;
|
|
break;
|
|
case PERF_HPP_DIFF__DELTA:
|
|
case PERF_HPP_DIFF__DELTA:
|
|
fmt->color = hpp__color_delta;
|
|
fmt->color = hpp__color_delta;
|
|
|
|
+ fmt->sort = hist_entry__cmp_delta;
|
|
break;
|
|
break;
|
|
case PERF_HPP_DIFF__RATIO:
|
|
case PERF_HPP_DIFF__RATIO:
|
|
fmt->color = hpp__color_ratio;
|
|
fmt->color = hpp__color_ratio;
|
|
|
|
+ fmt->sort = hist_entry__cmp_ratio;
|
|
break;
|
|
break;
|
|
case PERF_HPP_DIFF__WEIGHTED_DIFF:
|
|
case PERF_HPP_DIFF__WEIGHTED_DIFF:
|
|
fmt->color = hpp__color_wdiff;
|
|
fmt->color = hpp__color_wdiff;
|
|
|
|
+ fmt->sort = hist_entry__cmp_wdiff;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
|
|
+ fmt->sort = hist_entry__cmp_nop;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
init_header(d, dfmt);
|
|
init_header(d, dfmt);
|
|
perf_hpp__column_register(fmt);
|
|
perf_hpp__column_register(fmt);
|
|
|
|
+ perf_hpp__register_sort_field(fmt);
|
|
}
|
|
}
|
|
|
|
|
|
static void ui_init(void)
|
|
static void ui_init(void)
|