mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
perf stat: Remove "unit" workarounds for metric-only
Remove code that tested the "unit" as in KB/sec for certain hard coded metric values and did workarounds. Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
a745c0831c
commit
1bcd627165
|
|
@ -592,42 +592,18 @@ static void print_metricgroup_header_std(struct perf_stat_config *config,
|
|||
fprintf(config->output, "%*s", MGROUP_LEN - n - 1, "");
|
||||
}
|
||||
|
||||
/* Filter out some columns that don't work well in metrics only mode */
|
||||
|
||||
static bool valid_only_metric(const char *unit)
|
||||
{
|
||||
if (!unit)
|
||||
return false;
|
||||
if (strstr(unit, "/sec") ||
|
||||
strstr(unit, "CPUs utilized"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char *fixunit(char *buf, struct evsel *evsel,
|
||||
const char *unit)
|
||||
{
|
||||
if (!strncmp(unit, "of all", 6)) {
|
||||
snprintf(buf, 1024, "%s %s", evsel__name(evsel),
|
||||
unit);
|
||||
return buf;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
||||
static void print_metric_only(struct perf_stat_config *config,
|
||||
void *ctx, enum metric_threshold_classify thresh,
|
||||
const char *fmt, const char *unit, double val)
|
||||
{
|
||||
struct outstate *os = ctx;
|
||||
FILE *out = os->fh;
|
||||
char buf[1024], str[1024];
|
||||
char str[1024];
|
||||
unsigned mlen = config->metric_only_len;
|
||||
const char *color = metric_threshold_classify__color(thresh);
|
||||
|
||||
if (!valid_only_metric(unit))
|
||||
return;
|
||||
unit = fixunit(buf, os->evsel, unit);
|
||||
if (!unit)
|
||||
unit = "";
|
||||
if (mlen < strlen(unit))
|
||||
mlen = strlen(unit) + 1;
|
||||
|
||||
|
|
@ -643,16 +619,15 @@ static void print_metric_only_csv(struct perf_stat_config *config __maybe_unused
|
|||
void *ctx,
|
||||
enum metric_threshold_classify thresh __maybe_unused,
|
||||
const char *fmt,
|
||||
const char *unit, double val)
|
||||
const char *unit __maybe_unused, double val)
|
||||
{
|
||||
struct outstate *os = ctx;
|
||||
FILE *out = os->fh;
|
||||
char buf[64], *vals, *ends;
|
||||
char tbuf[1024];
|
||||
|
||||
if (!valid_only_metric(unit))
|
||||
if (!unit)
|
||||
return;
|
||||
unit = fixunit(tbuf, os->evsel, unit);
|
||||
|
||||
snprintf(buf, sizeof(buf), fmt ?: "", val);
|
||||
ends = vals = skip_spaces(buf);
|
||||
while (isdigit(*ends) || *ends == '.')
|
||||
|
|
@ -670,13 +645,9 @@ static void print_metric_only_json(struct perf_stat_config *config __maybe_unuse
|
|||
{
|
||||
struct outstate *os = ctx;
|
||||
char buf[64], *ends;
|
||||
char tbuf[1024];
|
||||
const char *vals;
|
||||
|
||||
if (!valid_only_metric(unit))
|
||||
return;
|
||||
unit = fixunit(tbuf, os->evsel, unit);
|
||||
if (!unit[0])
|
||||
if (!unit || !unit[0])
|
||||
return;
|
||||
snprintf(buf, sizeof(buf), fmt ?: "", val);
|
||||
vals = ends = skip_spaces(buf);
|
||||
|
|
@ -695,7 +666,6 @@ static void print_metric_header(struct perf_stat_config *config,
|
|||
const char *unit, double val __maybe_unused)
|
||||
{
|
||||
struct outstate *os = ctx;
|
||||
char tbuf[1024];
|
||||
|
||||
/* In case of iostat, print metric header for first root port only */
|
||||
if (config->iostat_run &&
|
||||
|
|
@ -705,9 +675,8 @@ static void print_metric_header(struct perf_stat_config *config,
|
|||
if (os->evsel->cgrp != os->cgrp)
|
||||
return;
|
||||
|
||||
if (!valid_only_metric(unit))
|
||||
if (!unit)
|
||||
return;
|
||||
unit = fixunit(tbuf, os->evsel, unit);
|
||||
|
||||
if (config->json_output)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user