|
@@ -30,6 +30,7 @@ enum {
|
|
PERF_HPP_DIFF__RATIO,
|
|
PERF_HPP_DIFF__RATIO,
|
|
PERF_HPP_DIFF__WEIGHTED_DIFF,
|
|
PERF_HPP_DIFF__WEIGHTED_DIFF,
|
|
PERF_HPP_DIFF__FORMULA,
|
|
PERF_HPP_DIFF__FORMULA,
|
|
|
|
+ PERF_HPP_DIFF__DELTA_ABS,
|
|
|
|
|
|
PERF_HPP_DIFF__MAX_INDEX
|
|
PERF_HPP_DIFF__MAX_INDEX
|
|
};
|
|
};
|
|
@@ -73,11 +74,13 @@ enum {
|
|
COMPUTE_DELTA,
|
|
COMPUTE_DELTA,
|
|
COMPUTE_RATIO,
|
|
COMPUTE_RATIO,
|
|
COMPUTE_WEIGHTED_DIFF,
|
|
COMPUTE_WEIGHTED_DIFF,
|
|
|
|
+ COMPUTE_DELTA_ABS,
|
|
COMPUTE_MAX,
|
|
COMPUTE_MAX,
|
|
};
|
|
};
|
|
|
|
|
|
const char *compute_names[COMPUTE_MAX] = {
|
|
const char *compute_names[COMPUTE_MAX] = {
|
|
[COMPUTE_DELTA] = "delta",
|
|
[COMPUTE_DELTA] = "delta",
|
|
|
|
+ [COMPUTE_DELTA_ABS] = "delta-abs",
|
|
[COMPUTE_RATIO] = "ratio",
|
|
[COMPUTE_RATIO] = "ratio",
|
|
[COMPUTE_WEIGHTED_DIFF] = "wdiff",
|
|
[COMPUTE_WEIGHTED_DIFF] = "wdiff",
|
|
};
|
|
};
|
|
@@ -86,6 +89,7 @@ static int compute;
|
|
|
|
|
|
static int compute_2_hpp[COMPUTE_MAX] = {
|
|
static int compute_2_hpp[COMPUTE_MAX] = {
|
|
[COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA,
|
|
[COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA,
|
|
|
|
+ [COMPUTE_DELTA_ABS] = PERF_HPP_DIFF__DELTA_ABS,
|
|
[COMPUTE_RATIO] = PERF_HPP_DIFF__RATIO,
|
|
[COMPUTE_RATIO] = PERF_HPP_DIFF__RATIO,
|
|
[COMPUTE_WEIGHTED_DIFF] = PERF_HPP_DIFF__WEIGHTED_DIFF,
|
|
[COMPUTE_WEIGHTED_DIFF] = PERF_HPP_DIFF__WEIGHTED_DIFF,
|
|
};
|
|
};
|
|
@@ -111,6 +115,10 @@ static struct header_column {
|
|
.name = "Delta",
|
|
.name = "Delta",
|
|
.width = 7,
|
|
.width = 7,
|
|
},
|
|
},
|
|
|
|
+ [PERF_HPP_DIFF__DELTA_ABS] = {
|
|
|
|
+ .name = "Delta Abs",
|
|
|
|
+ .width = 7,
|
|
|
|
+ },
|
|
[PERF_HPP_DIFF__RATIO] = {
|
|
[PERF_HPP_DIFF__RATIO] = {
|
|
.name = "Ratio",
|
|
.name = "Ratio",
|
|
.width = 14,
|
|
.width = 14,
|
|
@@ -298,6 +306,7 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,
|
|
{
|
|
{
|
|
switch (compute) {
|
|
switch (compute) {
|
|
case COMPUTE_DELTA:
|
|
case COMPUTE_DELTA:
|
|
|
|
+ case COMPUTE_DELTA_ABS:
|
|
return formula_delta(he, pair, buf, size);
|
|
return formula_delta(he, pair, buf, size);
|
|
case COMPUTE_RATIO:
|
|
case COMPUTE_RATIO:
|
|
return formula_ratio(he, pair, buf, size);
|
|
return formula_ratio(he, pair, buf, size);
|
|
@@ -461,6 +470,7 @@ static void hists__precompute(struct hists *hists)
|
|
|
|
|
|
switch (compute) {
|
|
switch (compute) {
|
|
case COMPUTE_DELTA:
|
|
case COMPUTE_DELTA:
|
|
|
|
+ case COMPUTE_DELTA_ABS:
|
|
compute_delta(he, pair);
|
|
compute_delta(he, pair);
|
|
break;
|
|
break;
|
|
case COMPUTE_RATIO:
|
|
case COMPUTE_RATIO:
|
|
@@ -498,6 +508,13 @@ __hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right,
|
|
|
|
|
|
return cmp_doubles(l, r);
|
|
return cmp_doubles(l, r);
|
|
}
|
|
}
|
|
|
|
+ case COMPUTE_DELTA_ABS:
|
|
|
|
+ {
|
|
|
|
+ double l = fabs(left->diff.period_ratio_delta);
|
|
|
|
+ double r = fabs(right->diff.period_ratio_delta);
|
|
|
|
+
|
|
|
|
+ return cmp_doubles(l, r);
|
|
|
|
+ }
|
|
case COMPUTE_RATIO:
|
|
case COMPUTE_RATIO:
|
|
{
|
|
{
|
|
double l = left->diff.period_ratio;
|
|
double l = left->diff.period_ratio;
|
|
@@ -564,7 +581,7 @@ hist_entry__cmp_compute_idx(struct hist_entry *left, struct hist_entry *right,
|
|
if (!p_left || !p_right)
|
|
if (!p_left || !p_right)
|
|
return p_left ? -1 : 1;
|
|
return p_left ? -1 : 1;
|
|
|
|
|
|
- if (c != COMPUTE_DELTA) {
|
|
|
|
|
|
+ if (c != COMPUTE_DELTA && c != COMPUTE_DELTA_ABS) {
|
|
/*
|
|
/*
|
|
* The delta can be computed without the baseline, but
|
|
* The delta can be computed without the baseline, but
|
|
* others are not. Put those entries which have no
|
|
* others are not. Put those entries which have no
|
|
@@ -606,6 +623,15 @@ hist_entry__cmp_delta(struct perf_hpp_fmt *fmt,
|
|
return hist_entry__cmp_compute(right, left, COMPUTE_DELTA, d->idx);
|
|
return hist_entry__cmp_compute(right, left, COMPUTE_DELTA, d->idx);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_delta_abs(struct perf_hpp_fmt *fmt,
|
|
|
|
+ struct hist_entry *left, struct hist_entry *right)
|
|
|
|
+{
|
|
|
|
+ struct data__file *d = fmt_to_data_file(fmt);
|
|
|
|
+
|
|
|
|
+ return hist_entry__cmp_compute(right, left, COMPUTE_DELTA_ABS, d->idx);
|
|
|
|
+}
|
|
|
|
+
|
|
static int64_t
|
|
static int64_t
|
|
hist_entry__cmp_ratio(struct perf_hpp_fmt *fmt,
|
|
hist_entry__cmp_ratio(struct perf_hpp_fmt *fmt,
|
|
struct hist_entry *left, struct hist_entry *right)
|
|
struct hist_entry *left, struct hist_entry *right)
|
|
@@ -632,6 +658,14 @@ hist_entry__cmp_delta_idx(struct perf_hpp_fmt *fmt __maybe_unused,
|
|
sort_compute);
|
|
sort_compute);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int64_t
|
|
|
|
+hist_entry__cmp_delta_abs_idx(struct perf_hpp_fmt *fmt __maybe_unused,
|
|
|
|
+ struct hist_entry *left, struct hist_entry *right)
|
|
|
|
+{
|
|
|
|
+ return hist_entry__cmp_compute_idx(right, left, COMPUTE_DELTA_ABS,
|
|
|
|
+ sort_compute);
|
|
|
|
+}
|
|
|
|
+
|
|
static int64_t
|
|
static int64_t
|
|
hist_entry__cmp_ratio_idx(struct perf_hpp_fmt *fmt __maybe_unused,
|
|
hist_entry__cmp_ratio_idx(struct perf_hpp_fmt *fmt __maybe_unused,
|
|
struct hist_entry *left, struct hist_entry *right)
|
|
struct hist_entry *left, struct hist_entry *right)
|
|
@@ -775,7 +809,7 @@ static const struct option options[] = {
|
|
OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
|
|
OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
|
|
"Show only items with match in baseline"),
|
|
"Show only items with match in baseline"),
|
|
OPT_CALLBACK('c', "compute", &compute,
|
|
OPT_CALLBACK('c', "compute", &compute,
|
|
- "delta,ratio,wdiff:w1,w2 (default delta)",
|
|
|
|
|
|
+ "delta,delta-abs,ratio,wdiff:w1,w2 (default delta)",
|
|
"Entries differential computation selection",
|
|
"Entries differential computation selection",
|
|
setup_compute),
|
|
setup_compute),
|
|
OPT_BOOLEAN('p', "period", &show_period,
|
|
OPT_BOOLEAN('p', "period", &show_period,
|
|
@@ -945,6 +979,7 @@ hpp__entry_pair(struct hist_entry *he, struct hist_entry *pair,
|
|
|
|
|
|
switch (idx) {
|
|
switch (idx) {
|
|
case PERF_HPP_DIFF__DELTA:
|
|
case PERF_HPP_DIFF__DELTA:
|
|
|
|
+ case PERF_HPP_DIFF__DELTA_ABS:
|
|
if (pair->diff.computed)
|
|
if (pair->diff.computed)
|
|
diff = pair->diff.period_ratio_delta;
|
|
diff = pair->diff.period_ratio_delta;
|
|
else
|
|
else
|
|
@@ -1118,6 +1153,10 @@ static void data__hpp_register(struct data__file *d, int idx)
|
|
fmt->color = hpp__color_wdiff;
|
|
fmt->color = hpp__color_wdiff;
|
|
fmt->sort = hist_entry__cmp_wdiff;
|
|
fmt->sort = hist_entry__cmp_wdiff;
|
|
break;
|
|
break;
|
|
|
|
+ case PERF_HPP_DIFF__DELTA_ABS:
|
|
|
|
+ fmt->color = hpp__color_delta;
|
|
|
|
+ fmt->sort = hist_entry__cmp_delta_abs;
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
fmt->sort = hist_entry__cmp_nop;
|
|
fmt->sort = hist_entry__cmp_nop;
|
|
break;
|
|
break;
|
|
@@ -1195,6 +1234,9 @@ static int ui_init(void)
|
|
case COMPUTE_WEIGHTED_DIFF:
|
|
case COMPUTE_WEIGHTED_DIFF:
|
|
fmt->sort = hist_entry__cmp_wdiff_idx;
|
|
fmt->sort = hist_entry__cmp_wdiff_idx;
|
|
break;
|
|
break;
|
|
|
|
+ case COMPUTE_DELTA_ABS:
|
|
|
|
+ fmt->sort = hist_entry__cmp_delta_abs_idx;
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
BUG_ON(1);
|
|
BUG_ON(1);
|
|
}
|
|
}
|