Re: [PATCH 5/5] perf: Make perf aware of tracefs

From: Namhyung Kim
Date: Sun Jan 25 2015 - 08:50:35 EST


Hi Steve,

On Sat, Jan 24, 2015 at 01:13:35PM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
>
> As tracefs may be mounted instead of debugfs to get to the event directories,
> have perf know about tracefs, and use that file system over debugfs if it
> is present.
>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> ---
> const char *find_tracing_dir(void)
> {
> + const char *tracing_dir = "";
> static char *tracing;
> static int tracing_found;
> const char *debugfs;
> @@ -351,11 +385,15 @@ const char *find_tracing_dir(void)
> if (tracing_found)
> return tracing;
>
> - debugfs = find_debugfs();
> - if (!debugfs)
> - return NULL;
> + debugfs = find_tracefs();
> + if (!debugfs) {
> + tracing_dir = "/tracing";
> + debugfs = find_debugfs();
> + if (!debugfs)
> + return NULL;
> + }
>
> - if (asprintf(&tracing, "%s/tracing", debugfs) < 0)
> + if (asprintf(&tracing, "%s%s", tracing_dir, debugfs) < 0)

s/tracing_dir, debugfs/debugfs, tracing_dir/

Thanks,
Namhyung


> return NULL;
>
> tracing_found = 1;
> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> index 027a5153495c..73c2f8e557ab 100644
> --- a/tools/perf/util/util.h
> +++ b/tools/perf/util/util.h
> @@ -75,6 +75,7 @@
> #include <linux/types.h>
> #include <sys/ttydefaults.h>
> #include <api/fs/debugfs.h>
> +#include <api/fs/tracefs.h>
> #include <termios.h>
> #include <linux/bitops.h>
> #include <termios.h>
> --
> 2.1.4
>
>
--
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/