|
@@ -16,20 +16,15 @@
|
|
})
|
|
})
|
|
|
|
|
|
int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
|
|
int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
|
|
- hpp_field_fn get_field, hpp_callback_fn callback,
|
|
|
|
- const char *fmt, hpp_snprint_fn print_fn, bool fmt_percent)
|
|
|
|
|
|
+ hpp_field_fn get_field, const char *fmt,
|
|
|
|
+ hpp_snprint_fn print_fn, bool fmt_percent)
|
|
{
|
|
{
|
|
- int ret = 0;
|
|
|
|
|
|
+ int ret;
|
|
struct hists *hists = he->hists;
|
|
struct hists *hists = he->hists;
|
|
struct perf_evsel *evsel = hists_to_evsel(hists);
|
|
struct perf_evsel *evsel = hists_to_evsel(hists);
|
|
char *buf = hpp->buf;
|
|
char *buf = hpp->buf;
|
|
size_t size = hpp->size;
|
|
size_t size = hpp->size;
|
|
|
|
|
|
- if (callback) {
|
|
|
|
- ret = callback(hpp, true);
|
|
|
|
- advance_hpp(hpp, ret);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (fmt_percent) {
|
|
if (fmt_percent) {
|
|
double percent = 0.0;
|
|
double percent = 0.0;
|
|
u64 total = hists__total_period(hists);
|
|
u64 total = hists__total_period(hists);
|
|
@@ -37,9 +32,9 @@ int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
|
|
if (total)
|
|
if (total)
|
|
percent = 100.0 * get_field(he) / total;
|
|
percent = 100.0 * get_field(he) / total;
|
|
|
|
|
|
- ret += hpp__call_print_fn(hpp, print_fn, fmt, percent);
|
|
|
|
|
|
+ ret = hpp__call_print_fn(hpp, print_fn, fmt, percent);
|
|
} else
|
|
} else
|
|
- ret += hpp__call_print_fn(hpp, print_fn, fmt, get_field(he));
|
|
|
|
|
|
+ ret = hpp__call_print_fn(hpp, print_fn, fmt, get_field(he));
|
|
|
|
|
|
if (perf_evsel__is_group_event(evsel)) {
|
|
if (perf_evsel__is_group_event(evsel)) {
|
|
int prev_idx, idx_delta;
|
|
int prev_idx, idx_delta;
|
|
@@ -99,13 +94,6 @@ int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (callback) {
|
|
|
|
- int __ret = callback(hpp, false);
|
|
|
|
-
|
|
|
|
- advance_hpp(hpp, __ret);
|
|
|
|
- ret += __ret;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Restore original buf and size as it's where caller expects
|
|
* Restore original buf and size as it's where caller expects
|
|
* the result will be saved.
|
|
* the result will be saved.
|
|
@@ -235,7 +223,7 @@ static u64 he_get_##_field(struct hist_entry *he) \
|
|
static int hpp__color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
|
|
static int hpp__color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
|
|
struct perf_hpp *hpp, struct hist_entry *he) \
|
|
struct perf_hpp *hpp, struct hist_entry *he) \
|
|
{ \
|
|
{ \
|
|
- return __hpp__fmt(hpp, he, he_get_##_field, NULL, " %6.2f%%", \
|
|
|
|
|
|
+ return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \
|
|
hpp_color_scnprintf, true); \
|
|
hpp_color_scnprintf, true); \
|
|
}
|
|
}
|
|
|
|
|
|
@@ -244,7 +232,7 @@ static int hpp__entry_##_type(struct perf_hpp_fmt *_fmt __maybe_unused, \
|
|
struct perf_hpp *hpp, struct hist_entry *he) \
|
|
struct perf_hpp *hpp, struct hist_entry *he) \
|
|
{ \
|
|
{ \
|
|
const char *fmt = symbol_conf.field_sep ? " %.2f" : " %6.2f%%"; \
|
|
const char *fmt = symbol_conf.field_sep ? " %.2f" : " %6.2f%%"; \
|
|
- return __hpp__fmt(hpp, he, he_get_##_field, NULL, fmt, \
|
|
|
|
|
|
+ return __hpp__fmt(hpp, he, he_get_##_field, fmt, \
|
|
hpp_entry_scnprintf, true); \
|
|
hpp_entry_scnprintf, true); \
|
|
}
|
|
}
|
|
|
|
|
|
@@ -264,7 +252,7 @@ static int hpp__entry_##_type(struct perf_hpp_fmt *_fmt __maybe_unused, \
|
|
struct perf_hpp *hpp, struct hist_entry *he) \
|
|
struct perf_hpp *hpp, struct hist_entry *he) \
|
|
{ \
|
|
{ \
|
|
const char *fmt = symbol_conf.field_sep ? " %"PRIu64 : " %11"PRIu64; \
|
|
const char *fmt = symbol_conf.field_sep ? " %"PRIu64 : " %11"PRIu64; \
|
|
- return __hpp__fmt(hpp, he, he_get_raw_##_field, NULL, fmt, \
|
|
|
|
|
|
+ return __hpp__fmt(hpp, he, he_get_raw_##_field, fmt, \
|
|
hpp_entry_scnprintf, false); \
|
|
hpp_entry_scnprintf, false); \
|
|
}
|
|
}
|
|
|
|
|