Re: [RFC PATCH 1/1] perf arm64: Implement --topdown with metrics

From: John Garry
Date: Fri Jan 28 2022 - 13:01:39 EST


On 05/01/2022 16:58, Andrew Kilroy wrote:



Sorry for very slow response..

The --topdown kernel event colouring is dictated by a large if-else statement in stat-shadow.c:perf_stat__print_shadow_stats.

There are branches depending on what is returned by perf_stat_evsel__is() for example

    } else if (perf_stat_evsel__is(evsel, TOPDOWN_FETCH_BUBBLES)) {
        double fe_bound = td_fe_bound(cpu, st, &rsd);

        if (fe_bound > 0.2)
            color = PERF_COLOR_RED;
        print_metric(config, ctxp, color, "%8.1f%%", "frontend bound",
                fe_bound * 100.);
    } else if (perf_stat_evsel__is(evsel, TOPDOWN_SLOTS_RETIRED)) {



Because the patches are enabling metrics (equivalent of the -M 'somemetricname' option), the perf_stat__print_shadow_stats function always makes calls to generic_metric(), where colours are never picked.

Seeing thresholds like:

  retiring > 0.7
  fe_bound > 0.2
  be_bound > 0.2
  bad_spec > 0.1


I'm not sure about adding the colouring really.  Are these thresholds x86 specific?

There is info on topdown for vtune here:

https://www.intel.com/content/www/us/en/develop/documentation/vtune-cookbook/top/methodologies/top-down-microarchitecture-analysis-method.html

The threshold info described there seems somewhat consistent with perf tool topdown thresholds and that is based on general guidelines for certain compute categories.

Andi did mention "specification" here:
https://lore.kernel.org/lkml/CABPqkBRftsHEAEwgCn3i3=mfk9fjh5r4MycdjHKRka5voTj9JA@xxxxxxxxxxxxxx/

But I don't know it, apart from a paper:
file:///home/john/Downloads/TopDown-Yasin-ISPASS14.pdf

Thanks,
John