Re: perf: store and retrieve trace event names in the perf.data file

Peter Zijlstra
2009-08-10T09:50:27Z

Thanks for the CC :-)

On Sun, 2009-08-09 at 14:49 -0700, Arjan van de Ven wrote:
> +static void store_event_type(const char *orgname)
> +{
> + char filename[PATH_MAX], *c;
> + FILE *file;
> + int id;
> +
> + sprintf(filename, "/sys/kernel/debug/tracing/events/%s/id", orgname);

That should be using debugfs_path, as it stands this thing won't work on
any of my machines.

> + c = strchr(filename, ':');
> + if (c) *c = '/';
> +
> + file = fopen(filename, "r");
> + if (!file)
> + return;
> + fscanf(file, "%i", &id);
> + fclose(file);
> + perf_header__push_event(id, orgname);
> +}