Re: [PATCH v6 2/4] perf jevents: Add python converter script

From: Ian Rogers
Date: Wed Jun 29 2022 - 14:11:50 EST


On Wed, Jun 29, 2022 at 9:56 AM John Garry <john.garry@xxxxxxxxxx> wrote:
>
> On 27/06/2022 03:57, Ian Rogers wrote:
> > +
> > + def unit_to_pmu(unit: str) -> str:
> > + """Convert a JSON Unit to Linux PMU name."""
> > + if not unit:
> > + return None
> > + # Comment brought over from jevents.c:
> > + # it's not realistic to keep adding these, we need something more scalable ...
>
> Since we're converting to python it might be a good idea to consider
> this - ever have an ideas on something better?

I think it is something ripe for cleanup, no particular thoughts on
this case. I'd like to make it so that jevents/pmu-events is aligned
with sysfs, which this relates to.

Thanks,
Ian

> Thanks,
> John
>
> > + table = {
> > + 'CBO': 'uncore_cbox',
> > + 'QPI LL': 'uncore_qpi',
> > + 'SBO': 'uncore_sbox',
> > + 'iMPH-U': 'uncore_arb',
> > + 'CPU-M-CF': 'cpum_cf',
> > + 'CPU-M-SF': 'cpum_sf',
> > + 'UPI LL': 'uncore_upi',
> > + 'hisi_sicl,cpa': 'hisi_sicl,cpa',
> > + 'hisi_sccl,ddrc': 'hisi_sccl,ddrc',
> > + 'hisi_sccl,hha': 'hisi_sccl,hha',
> > + 'hisi_sccl,l3c': 'hisi_sccl,l3c',
> > + 'imx8_ddr': 'imx8_ddr',
> > + 'L3PMC': 'amd_l3',
> > + 'DFPMC': 'amd_df',
> > + 'cpu_core': 'cpu_core',
> > + 'cpu_atom': 'cpu_atom',
> > + }
> > + return table[unit] if unit in table else f'uncore_{unit.lower()}'
> > +
>