• Ian Rogers's avatar
    perf jevents: Compress the pmu_events_table · 9118259c
    Ian Rogers authored
    The pmu_events array requires 15 pointers per entry which in position
    independent code need relocating. Change the array to be an array of
    offsets within a big C string. Only the offset of the first variable is
    required, subsequent variables are stored in order after the \0
    terminator (requiring a byte per variable rather than 4 bytes per
    offset).
    
    The file size savings are:
    
    no jevents - the same 19,788,464bytes
    x86 jevents - ~16.7% file size saving 23,744,288bytes vs 28,502,632bytes
    all jevents - ~19.5% file size saving 24,469,056bytes vs 30,379,920bytes
    default build options plus NO_LIBBFD=1.
    
    For example, the x86 build savings come from .rela.dyn and
    .data.rel.ro becoming smaller by 3,157,032bytes and 3,042,016bytes
    respectively. .rodata increases by 1,432,448bytes, giving an overall
    4,766,600bytes saving.
    
    To make metric strings more shareable, the topic is changed from say
    'skx metrics' to just 'metrics'.
    
    To try to help with the memory layout the pmu_events are ordered as used
    by perf qsort comparator functions.
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: John Garry <john.garry@huawei.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mike Leach <mike.leach@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Link: https://lore.kernel.org/r/20220812230949.683239-14-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    9118259c
jevents.py 21.2 KB