Re: [PATCH RFC 5/7] perf pmu: Support matching by sysid

From: Jiri Olsa
Date: Mon Feb 10 2020 - 07:08:20 EST


On Fri, Jan 24, 2020 at 10:35:03PM +0800, John Garry wrote:

SNIP

> + fclose(file);
> + pr_debug("gets failed for file %s\n", path);
> + free(buf);
> + return NULL;
> + }
> + fclose(file);
> +
> + /* Remove any whitespace, this could be from ACPI HID */
> + s = strlen(buf);
> + for (i = 0; i < s; i++) {
> + if (buf[i] == ' ') {
> + buf[i] = 0;
> + break;
> + };
> + }
> +
> + return buf;
> +}
> +
> +static char *perf_pmu__getsysid(void)
> +{
> + char *sysid;
> + static bool printed;
> +
> + sysid = getenv("PERF_SYSID");
> + if (sysid)
> + sysid = strdup(sysid);
> +
> + if (!sysid)
> + sysid = get_sysid_str();
> + if (!sysid)
> + return NULL;
> +
> + if (!printed) {
> + pr_debug("Using SYSID %s\n", sysid);
> + printed = true;
> + }
> + return sysid;
> +}

this part is getting complicated and AFAIK we have no tests for it

if you could think of any tests that'd be great.. perhaps we could
load 'our' json test files and check appropriate events/aliasses
via in pmu object.. or via parse_events interface.. those test aliases
would have to be part of perf, but we have tests compiled in anyway

thanks,
jirka