On Fri, 2014-07-11 at 16:59 -0700, Andi Kleen wrote:
> From: Andi Kleen <a...@linux.intel.com>
> 
> When no JSON event file is specified automatically look
> for a suitable file in ~/.cache/pmu-events. A "perf download" can
> automatically add files there for the current CPUs.
... 

> diff --git a/tools/perf/arch/x86/util/header.c 
> b/tools/perf/arch/x86/util/header.c
> index 146d12a..76e0ece 100644
> --- a/tools/perf/arch/x86/util/header.c
> +++ b/tools/perf/arch/x86/util/header.c
> @@ -57,3 +58,15 @@ get_cpuid(char *buffer, size_t sz)
>       }
>       return -1;
>  }
> +
> +int get_cpuid(char *buffer, size_t sz)
> +{
> +     return __get_cpuid(buffer, sz, "%s,%u,%u,%u$");
> +}
> +
> +char *get_cpu_str(void)
> +{
> +     char *buf = malloc(128);

I realise malloc failure is unlikely, but it's not impossible right?

Seems like it'd be cleaner if the caller allocated the buffer.

> +     __get_cpuid(buf, 128, "%s-%d-%X-core");
> +     return buf;
> +}

cheers


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

Reply via email to