Re: [PATCH 4/9] perf, tools: Automatically look for event file name for cpu v3

From: Sukadev Bhattiprolu
Date: Tue Jul 08 2014 - 22:14:07 EST


Andi Kleen [andi@xxxxxxxxxxxxxx] wrote:

| +static const char *json_default_name(void)
| +{
| + char *cache;
| + char *idstr = get_cpu_str();
| + char *res = NULL;
| + char *home = NULL;
| + char *emap;
| +
| + emap = getenv("EVENTMAP");
| + if (emap) {
| + if (access(emap, R_OK) == 0)
| + return emap;
| + if (asprintf(&idstr, "%s-core", emap) < 0)
| + return NULL;
| + }

Hi Andi,

Couple of questions/comments about EVENTMAP and the "core" suffix.

Is EVENTMAP a new environment variable ? If specific to PERF, should
we prefix it with "PERF_" to avoid collision?

Would all/many architectures need this "-core" suffix or is that Intel
specific ?

Is the intent that architectures that don't need this should simply
never set EVENTMAP variable ?

| +
| + cache = getenv("XDG_CACHE_HOME");
| + if (!cache) {
| + home = getenv("HOME");
| + if (!home || asprintf(&cache, "%s/.cache", home) < 0)
| + goto out;
| + }

As with XDG_CACHE_HOME in perf-download.txt, can you please add a note
about usage of EVENTMAP in the man page.

| + if (cache && idstr)
| + res = mkpath("%s/pmu-events/%s.json",
| + cache,
| + idstr);
| + if (home)
| + free(cache);
| +out:
| + free(idstr);
| + return res;
| +}
| +

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/