Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213887 > unrolled thread

[PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

Started byJiri Olsa <jolsa@kernel.org>
First post2015-08-26 15:50 +0200
Last post2015-08-31 09:50 +0200
Articles 7 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace Jiri Olsa <jolsa@kernel.org> - 2015-08-26 15:50 +0200
    Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same  namespace Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-26 16:50 +0200
      Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same  namespace Jiri Olsa <jolsa@redhat.com> - 2015-08-26 16:50 +0200
        Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same  namespace Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-26 17:00 +0200
          Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same  namespace Jiri Olsa <jolsa@redhat.com> - 2015-08-26 17:10 +0200
            Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same  namespace Matt Fleming <matt@codeblueprint.co.uk> - 2015-08-28 15:10 +0200
              Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same  namespace Jiri Olsa <jolsa@redhat.com> - 2015-08-31 09:50 +0200

#1213887 — [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromJiri Olsa <jolsa@kernel.org>
Date2015-08-26 15:50 +0200
Subject[PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q1Jft-7l6-19@gated-at.bofh.it>
Renaming all functions touching tracing_path under same
namespace. New interface is:

  char tracing_path[];
  char tracing_events_path[];
  - tracing mount

  void perf_tracing_path_set(const char *mountpoint);
  - setting directly tracing_path(_events), used by --debugfs-dir option

  const char *perf_tracing_path_mount(const char *mountpoint);
  - initial setup of tracing_path(_events), called from perf.c

  int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
  int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
  - strerror functions to get error string when failing to open
    tracepoint files

  char *get_tracing_file(const char *name);
  void put_tracing_file(char *file);
  - get/put tracing file path

Link: http://lkml.kernel.org/n/tip-miy6kftxxryjf40b3qb6eknc@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-trace.c |  4 ++--
 tools/perf/perf.c          |  8 ++++----
 tools/perf/util/util.c     | 26 +++++++++++++-------------
 tools/perf/util/util.h     |  8 ++++----
 4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 2f1162daa3c5..384ebe32698a 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2667,11 +2667,11 @@ out_delete_evlist:
 	char errbuf[BUFSIZ];
 
 out_error_sched_stat_runtime:
-	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
+	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
 	goto out_error;
 
 out_error_raw_syscalls:
-	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
+	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
 	goto out_error;
 
 out_error_mmap:
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 07dbff5c0e60..c5acdadde347 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 				fprintf(stderr, "No directory given for --debugfs-dir.\n");
 				usage(perf_usage_string);
 			}
-			perf_debugfs_set_path((*argv)[1]);
+			perf_tracing_path_set((*argv)[1]);
 			if (envchanged)
 				*envchanged = 1;
 			(*argv)++;
@@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			(*argv)++;
 			(*argc)--;
 		} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
-			perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
+			perf_tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
 			fprintf(stderr, "dir: %s\n", tracing_path);
 			if (envchanged)
 				*envchanged = 1;
@@ -517,8 +517,8 @@ int main(int argc, const char **argv)
 	cmd = perf_extract_argv0_path(argv[0]);
 	if (!cmd)
 		cmd = "perf-help";
-	/* get debugfs mount point from /proc/mounts */
-	perf_debugfs_mount(NULL);
+	/* get debugfs/tracefs mount point from /proc/mounts */
+	perf_tracing_path_mount(NULL);
 	/*
 	 * "perf-xxxx" is the same as "perf xxxx", but we obviously:
 	 *
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 03d1d74a5ede..675d112a887d 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)
 	tcsetattr(0, TCSANOW, &tc);
 }
 
-static void set_tracing_events_path(const char *tracing, const char *mountpoint)
+static void tracing_path_set(const char *tracing, const char *mountpoint)
 {
 	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
 		 mountpoint, tracing);
@@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
 		 mountpoint, tracing, "events");
 }
 
-static const char *__perf_tracefs_mount(const char *mountpoint)
+static const char *tracing_path_tracefs_mount(const char *mountpoint)
 {
 	const char *mnt;
 
@@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(const char *mountpoint)
 	if (!mnt)
 		return NULL;
 
-	set_tracing_events_path("", mnt);
+	tracing_path_set("", mnt);
 
 	return mnt;
 }
 
-static const char *__perf_debugfs_mount(const char *mountpoint)
+static const char *tracing_path_debugfs_mount(const char *mountpoint)
 {
 	const char *mnt;
 
@@ -419,30 +419,30 @@ static const char *__perf_debugfs_mount(const char *mountpoint)
 	if (!mnt)
 		return NULL;
 
-	set_tracing_events_path("tracing/", mnt);
+	tracing_path_set("tracing/", mnt);
 
 	return mnt;
 }
 
-const char *perf_debugfs_mount(const char *mountpoint)
+const char *perf_tracing_path_mount(const char *mountpoint)
 {
 	const char *mnt;
 
-	mnt = __perf_tracefs_mount(mountpoint);
+	mnt = tracing_path_tracefs_mount(mountpoint);
 	if (mnt)
 		return mnt;
 
-	mnt = __perf_debugfs_mount(mountpoint);
+	mnt = tracing_path_debugfs_mount(mountpoint);
 
 	return mnt;
 }
 
-void perf_debugfs_set_path(const char *mntpt)
+void perf_tracing_path_set(const char *mntpt)
 {
-	set_tracing_events_path("tracing/", mntpt);
+	tracing_path_set("tracing/", mntpt);
 }
 
-int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
+int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename)
 {
 	char sbuf[128];
 
@@ -485,13 +485,13 @@ int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename
 	return 0;
 }
 
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
+int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
 {
 	char path[PATH_MAX];
 
 	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
 
-	return debugfs__strerror_open(err, buf, size, path);
+	return tracing_path_strerror_open(err, buf, size, path);
 }
 
 char *get_tracing_file(const char *name)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index da48c00ab0db..34a68faf53fe 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -85,10 +85,10 @@ extern const char *graph_dotted_line;
 extern char buildid_dir[];
 extern char tracing_path[];
 extern char tracing_events_path[];
-extern void perf_debugfs_set_path(const char *mountpoint);
-const char *perf_debugfs_mount(const char *mountpoint);
-int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
+extern void perf_tracing_path_set(const char *mountpoint);
+const char *perf_tracing_path_mount(const char *mountpoint);
+int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
+int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
 char *get_tracing_file(const char *name);
 void put_tracing_file(char *file);
 
-- 
2.4.3

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

[toc] | [next] | [standalone]


#1213936 — Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-08-26 16:50 +0200
SubjectRe: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q1Kbw-fe-19@gated-at.bofh.it>
In reply to#1213887
Em Wed, Aug 26, 2015 at 03:46:47PM +0200, Jiri Olsa escreveu:
> Renaming all functions touching tracing_path under same
> namespace. New interface is:

But we were trying to have debugfs stuff in tools/lib/api/fs/, so that
it could eventually be used by some other tools, etc, and now we're
going the other way around, de-librarifying, not good :-\

- Arnaldo
 
>   char tracing_path[];
>   char tracing_events_path[];
>   - tracing mount
> 
>   void perf_tracing_path_set(const char *mountpoint);
>   - setting directly tracing_path(_events), used by --debugfs-dir option
> 
>   const char *perf_tracing_path_mount(const char *mountpoint);
>   - initial setup of tracing_path(_events), called from perf.c
> 
>   int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
>   int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
>   - strerror functions to get error string when failing to open
>     tracepoint files
> 
>   char *get_tracing_file(const char *name);
>   void put_tracing_file(char *file);
>   - get/put tracing file path
> 
> Link: http://lkml.kernel.org/n/tip-miy6kftxxryjf40b3qb6eknc@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/builtin-trace.c |  4 ++--
>  tools/perf/perf.c          |  8 ++++----
>  tools/perf/util/util.c     | 26 +++++++++++++-------------
>  tools/perf/util/util.h     |  8 ++++----
>  4 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 2f1162daa3c5..384ebe32698a 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -2667,11 +2667,11 @@ out_delete_evlist:
>  	char errbuf[BUFSIZ];
>  
>  out_error_sched_stat_runtime:
> -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
> +	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
>  	goto out_error;
>  
>  out_error_raw_syscalls:
> -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
> +	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
>  	goto out_error;
>  
>  out_error_mmap:
> diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> index 07dbff5c0e60..c5acdadde347 100644
> --- a/tools/perf/perf.c
> +++ b/tools/perf/perf.c
> @@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>  				fprintf(stderr, "No directory given for --debugfs-dir.\n");
>  				usage(perf_usage_string);
>  			}
> -			perf_debugfs_set_path((*argv)[1]);
> +			perf_tracing_path_set((*argv)[1]);
>  			if (envchanged)
>  				*envchanged = 1;
>  			(*argv)++;
> @@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>  			(*argv)++;
>  			(*argc)--;
>  		} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
> -			perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
> +			perf_tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
>  			fprintf(stderr, "dir: %s\n", tracing_path);
>  			if (envchanged)
>  				*envchanged = 1;
> @@ -517,8 +517,8 @@ int main(int argc, const char **argv)
>  	cmd = perf_extract_argv0_path(argv[0]);
>  	if (!cmd)
>  		cmd = "perf-help";
> -	/* get debugfs mount point from /proc/mounts */
> -	perf_debugfs_mount(NULL);
> +	/* get debugfs/tracefs mount point from /proc/mounts */
> +	perf_tracing_path_mount(NULL);
>  	/*
>  	 * "perf-xxxx" is the same as "perf xxxx", but we obviously:
>  	 *
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 03d1d74a5ede..675d112a887d 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)
>  	tcsetattr(0, TCSANOW, &tc);
>  }
>  
> -static void set_tracing_events_path(const char *tracing, const char *mountpoint)
> +static void tracing_path_set(const char *tracing, const char *mountpoint)
>  {
>  	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
>  		 mountpoint, tracing);
> @@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
>  		 mountpoint, tracing, "events");
>  }
>  
> -static const char *__perf_tracefs_mount(const char *mountpoint)
> +static const char *tracing_path_tracefs_mount(const char *mountpoint)
>  {
>  	const char *mnt;
>  
> @@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(const char *mountpoint)
>  	if (!mnt)
>  		return NULL;
>  
> -	set_tracing_events_path("", mnt);
> +	tracing_path_set("", mnt);
>  
>  	return mnt;
>  }
>  
> -static const char *__perf_debugfs_mount(const char *mountpoint)
> +static const char *tracing_path_debugfs_mount(const char *mountpoint)
>  {
>  	const char *mnt;
>  
> @@ -419,30 +419,30 @@ static const char *__perf_debugfs_mount(const char *mountpoint)
>  	if (!mnt)
>  		return NULL;
>  
> -	set_tracing_events_path("tracing/", mnt);
> +	tracing_path_set("tracing/", mnt);
>  
>  	return mnt;
>  }
>  
> -const char *perf_debugfs_mount(const char *mountpoint)
> +const char *perf_tracing_path_mount(const char *mountpoint)
>  {
>  	const char *mnt;
>  
> -	mnt = __perf_tracefs_mount(mountpoint);
> +	mnt = tracing_path_tracefs_mount(mountpoint);
>  	if (mnt)
>  		return mnt;
>  
> -	mnt = __perf_debugfs_mount(mountpoint);
> +	mnt = tracing_path_debugfs_mount(mountpoint);
>  
>  	return mnt;
>  }
>  
> -void perf_debugfs_set_path(const char *mntpt)
> +void perf_tracing_path_set(const char *mntpt)
>  {
> -	set_tracing_events_path("tracing/", mntpt);
> +	tracing_path_set("tracing/", mntpt);
>  }
>  
> -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
> +int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename)
>  {
>  	char sbuf[128];
>  
> @@ -485,13 +485,13 @@ int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename
>  	return 0;
>  }
>  
> -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> +int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
>  {
>  	char path[PATH_MAX];
>  
>  	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
>  
> -	return debugfs__strerror_open(err, buf, size, path);
> +	return tracing_path_strerror_open(err, buf, size, path);
>  }
>  
>  char *get_tracing_file(const char *name)
> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> index da48c00ab0db..34a68faf53fe 100644
> --- a/tools/perf/util/util.h
> +++ b/tools/perf/util/util.h
> @@ -85,10 +85,10 @@ extern const char *graph_dotted_line;
>  extern char buildid_dir[];
>  extern char tracing_path[];
>  extern char tracing_events_path[];
> -extern void perf_debugfs_set_path(const char *mountpoint);
> -const char *perf_debugfs_mount(const char *mountpoint);
> -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
> -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> +extern void perf_tracing_path_set(const char *mountpoint);
> +const char *perf_tracing_path_mount(const char *mountpoint);
> +int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
> +int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
>  char *get_tracing_file(const char *name);
>  void put_tracing_file(char *file);
>  
> -- 
> 2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1213937 — Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromJiri Olsa <jolsa@redhat.com>
Date2015-08-26 16:50 +0200
SubjectRe: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q1Kbw-fe-25@gated-at.bofh.it>
In reply to#1213936
On Wed, Aug 26, 2015 at 11:42:11AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Aug 26, 2015 at 03:46:47PM +0200, Jiri Olsa escreveu:
> > Renaming all functions touching tracing_path under same
> > namespace. New interface is:
> 
> But we were trying to have debugfs stuff in tools/lib/api/fs/, so that
> it could eventually be used by some other tools, etc, and now we're
> going the other way around, de-librarifying, not good :-\

well this gathers tracefs/debugfs together, the api/fs/{trace|debug}fs
are just building blocks

I only moved the debugfs__strerror_open_tp out of the debugfs object
because it needs to be one layer up, because it needs to touch tracefs
as well

jirka

> 
> - Arnaldo
>  
> >   char tracing_path[];
> >   char tracing_events_path[];
> >   - tracing mount
> > 
> >   void perf_tracing_path_set(const char *mountpoint);
> >   - setting directly tracing_path(_events), used by --debugfs-dir option
> > 
> >   const char *perf_tracing_path_mount(const char *mountpoint);
> >   - initial setup of tracing_path(_events), called from perf.c
> > 
> >   int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
> >   int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> >   - strerror functions to get error string when failing to open
> >     tracepoint files
> > 
> >   char *get_tracing_file(const char *name);
> >   void put_tracing_file(char *file);
> >   - get/put tracing file path
> > 
> > Link: http://lkml.kernel.org/n/tip-miy6kftxxryjf40b3qb6eknc@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/perf/builtin-trace.c |  4 ++--
> >  tools/perf/perf.c          |  8 ++++----
> >  tools/perf/util/util.c     | 26 +++++++++++++-------------
> >  tools/perf/util/util.h     |  8 ++++----
> >  4 files changed, 23 insertions(+), 23 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> > index 2f1162daa3c5..384ebe32698a 100644
> > --- a/tools/perf/builtin-trace.c
> > +++ b/tools/perf/builtin-trace.c
> > @@ -2667,11 +2667,11 @@ out_delete_evlist:
> >  	char errbuf[BUFSIZ];
> >  
> >  out_error_sched_stat_runtime:
> > -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
> > +	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
> >  	goto out_error;
> >  
> >  out_error_raw_syscalls:
> > -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
> > +	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
> >  	goto out_error;
> >  
> >  out_error_mmap:
> > diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> > index 07dbff5c0e60..c5acdadde347 100644
> > --- a/tools/perf/perf.c
> > +++ b/tools/perf/perf.c
> > @@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
> >  				fprintf(stderr, "No directory given for --debugfs-dir.\n");
> >  				usage(perf_usage_string);
> >  			}
> > -			perf_debugfs_set_path((*argv)[1]);
> > +			perf_tracing_path_set((*argv)[1]);
> >  			if (envchanged)
> >  				*envchanged = 1;
> >  			(*argv)++;
> > @@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
> >  			(*argv)++;
> >  			(*argc)--;
> >  		} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
> > -			perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
> > +			perf_tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
> >  			fprintf(stderr, "dir: %s\n", tracing_path);
> >  			if (envchanged)
> >  				*envchanged = 1;
> > @@ -517,8 +517,8 @@ int main(int argc, const char **argv)
> >  	cmd = perf_extract_argv0_path(argv[0]);
> >  	if (!cmd)
> >  		cmd = "perf-help";
> > -	/* get debugfs mount point from /proc/mounts */
> > -	perf_debugfs_mount(NULL);
> > +	/* get debugfs/tracefs mount point from /proc/mounts */
> > +	perf_tracing_path_mount(NULL);
> >  	/*
> >  	 * "perf-xxxx" is the same as "perf xxxx", but we obviously:
> >  	 *
> > diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> > index 03d1d74a5ede..675d112a887d 100644
> > --- a/tools/perf/util/util.c
> > +++ b/tools/perf/util/util.c
> > @@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)
> >  	tcsetattr(0, TCSANOW, &tc);
> >  }
> >  
> > -static void set_tracing_events_path(const char *tracing, const char *mountpoint)
> > +static void tracing_path_set(const char *tracing, const char *mountpoint)
> >  {
> >  	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
> >  		 mountpoint, tracing);
> > @@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
> >  		 mountpoint, tracing, "events");
> >  }
> >  
> > -static const char *__perf_tracefs_mount(const char *mountpoint)
> > +static const char *tracing_path_tracefs_mount(const char *mountpoint)
> >  {
> >  	const char *mnt;
> >  
> > @@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(const char *mountpoint)
> >  	if (!mnt)
> >  		return NULL;
> >  
> > -	set_tracing_events_path("", mnt);
> > +	tracing_path_set("", mnt);
> >  
> >  	return mnt;
> >  }
> >  
> > -static const char *__perf_debugfs_mount(const char *mountpoint)
> > +static const char *tracing_path_debugfs_mount(const char *mountpoint)
> >  {
> >  	const char *mnt;
> >  
> > @@ -419,30 +419,30 @@ static const char *__perf_debugfs_mount(const char *mountpoint)
> >  	if (!mnt)
> >  		return NULL;
> >  
> > -	set_tracing_events_path("tracing/", mnt);
> > +	tracing_path_set("tracing/", mnt);
> >  
> >  	return mnt;
> >  }
> >  
> > -const char *perf_debugfs_mount(const char *mountpoint)
> > +const char *perf_tracing_path_mount(const char *mountpoint)
> >  {
> >  	const char *mnt;
> >  
> > -	mnt = __perf_tracefs_mount(mountpoint);
> > +	mnt = tracing_path_tracefs_mount(mountpoint);
> >  	if (mnt)
> >  		return mnt;
> >  
> > -	mnt = __perf_debugfs_mount(mountpoint);
> > +	mnt = tracing_path_debugfs_mount(mountpoint);
> >  
> >  	return mnt;
> >  }
> >  
> > -void perf_debugfs_set_path(const char *mntpt)
> > +void perf_tracing_path_set(const char *mntpt)
> >  {
> > -	set_tracing_events_path("tracing/", mntpt);
> > +	tracing_path_set("tracing/", mntpt);
> >  }
> >  
> > -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
> > +int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename)
> >  {
> >  	char sbuf[128];
> >  
> > @@ -485,13 +485,13 @@ int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename
> >  	return 0;
> >  }
> >  
> > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> > +int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> >  {
> >  	char path[PATH_MAX];
> >  
> >  	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
> >  
> > -	return debugfs__strerror_open(err, buf, size, path);
> > +	return tracing_path_strerror_open(err, buf, size, path);
> >  }
> >  
> >  char *get_tracing_file(const char *name)
> > diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> > index da48c00ab0db..34a68faf53fe 100644
> > --- a/tools/perf/util/util.h
> > +++ b/tools/perf/util/util.h
> > @@ -85,10 +85,10 @@ extern const char *graph_dotted_line;
> >  extern char buildid_dir[];
> >  extern char tracing_path[];
> >  extern char tracing_events_path[];
> > -extern void perf_debugfs_set_path(const char *mountpoint);
> > -const char *perf_debugfs_mount(const char *mountpoint);
> > -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
> > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> > +extern void perf_tracing_path_set(const char *mountpoint);
> > +const char *perf_tracing_path_mount(const char *mountpoint);
> > +int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
> > +int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> >  char *get_tracing_file(const char *name);
> >  void put_tracing_file(char *file);
> >  
> > -- 
> > 2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1213941 — Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-08-26 17:00 +0200
SubjectRe: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q1Klb-qE-5@gated-at.bofh.it>
In reply to#1213937
Em Wed, Aug 26, 2015 at 04:48:36PM +0200, Jiri Olsa escreveu:
> On Wed, Aug 26, 2015 at 11:42:11AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Aug 26, 2015 at 03:46:47PM +0200, Jiri Olsa escreveu:
> > > Renaming all functions touching tracing_path under same
> > > namespace. New interface is:
> > 
> > But we were trying to have debugfs stuff in tools/lib/api/fs/, so that
> > it could eventually be used by some other tools, etc, and now we're
> > going the other way around, de-librarifying, not good :-\
> 
> well this gathers tracefs/debugfs together, the api/fs/{trace|debug}fs
> are just building blocks
> 
> I only moved the debugfs__strerror_open_tp out of the debugfs object
> because it needs to be one layer up, because it needs to touch tracefs
> as well

Why not leave it there, since, for historical reasons, what is tracefs
now was something implemented inside debugfs, so having that special
case in debugfs__strerror_open_tp():

                if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {

Is ok, since tools will need to deal with older kernels, etc.

But ok, I see your point, we should rename it to something like
tracepoint__strerror_open_definition(), so as to detach this from
"debugfs" _and_ "tracefs", pseudo-filesystem based DWARF-like stuff
(event definitions), but then why not have that somewhere in
tools/lib/api/tracepoint/.

Or was it the difficulty in getting this nicely namespaced what made
you get it back to tools/perf/util/?

I can have some empathy for that, if that is the case ;-\

- Arnaldo
 
> > 
> > - Arnaldo
> >  
> > >   char tracing_path[];
> > >   char tracing_events_path[];
> > >   - tracing mount
> > > 
> > >   void perf_tracing_path_set(const char *mountpoint);
> > >   - setting directly tracing_path(_events), used by --debugfs-dir option
> > > 
> > >   const char *perf_tracing_path_mount(const char *mountpoint);
> > >   - initial setup of tracing_path(_events), called from perf.c
> > > 
> > >   int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
> > >   int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> > >   - strerror functions to get error string when failing to open
> > >     tracepoint files
> > > 
> > >   char *get_tracing_file(const char *name);
> > >   void put_tracing_file(char *file);
> > >   - get/put tracing file path
> > > 
> > > Link: http://lkml.kernel.org/n/tip-miy6kftxxryjf40b3qb6eknc@git.kernel.org
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > ---
> > >  tools/perf/builtin-trace.c |  4 ++--
> > >  tools/perf/perf.c          |  8 ++++----
> > >  tools/perf/util/util.c     | 26 +++++++++++++-------------
> > >  tools/perf/util/util.h     |  8 ++++----
> > >  4 files changed, 23 insertions(+), 23 deletions(-)
> > > 
> > > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> > > index 2f1162daa3c5..384ebe32698a 100644
> > > --- a/tools/perf/builtin-trace.c
> > > +++ b/tools/perf/builtin-trace.c
> > > @@ -2667,11 +2667,11 @@ out_delete_evlist:
> > >  	char errbuf[BUFSIZ];
> > >  
> > >  out_error_sched_stat_runtime:
> > > -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
> > > +	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "sched", "sched_stat_runtime");
> > >  	goto out_error;
> > >  
> > >  out_error_raw_syscalls:
> > > -	debugfs__strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
> > > +	tracing_path_strerror_open_tp(errno, errbuf, sizeof(errbuf), "raw_syscalls", "sys_(enter|exit)");
> > >  	goto out_error;
> > >  
> > >  out_error_mmap:
> > > diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> > > index 07dbff5c0e60..c5acdadde347 100644
> > > --- a/tools/perf/perf.c
> > > +++ b/tools/perf/perf.c
> > > @@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
> > >  				fprintf(stderr, "No directory given for --debugfs-dir.\n");
> > >  				usage(perf_usage_string);
> > >  			}
> > > -			perf_debugfs_set_path((*argv)[1]);
> > > +			perf_tracing_path_set((*argv)[1]);
> > >  			if (envchanged)
> > >  				*envchanged = 1;
> > >  			(*argv)++;
> > > @@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
> > >  			(*argv)++;
> > >  			(*argc)--;
> > >  		} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
> > > -			perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
> > > +			perf_tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
> > >  			fprintf(stderr, "dir: %s\n", tracing_path);
> > >  			if (envchanged)
> > >  				*envchanged = 1;
> > > @@ -517,8 +517,8 @@ int main(int argc, const char **argv)
> > >  	cmd = perf_extract_argv0_path(argv[0]);
> > >  	if (!cmd)
> > >  		cmd = "perf-help";
> > > -	/* get debugfs mount point from /proc/mounts */
> > > -	perf_debugfs_mount(NULL);
> > > +	/* get debugfs/tracefs mount point from /proc/mounts */
> > > +	perf_tracing_path_mount(NULL);
> > >  	/*
> > >  	 * "perf-xxxx" is the same as "perf xxxx", but we obviously:
> > >  	 *
> > > diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> > > index 03d1d74a5ede..675d112a887d 100644
> > > --- a/tools/perf/util/util.c
> > > +++ b/tools/perf/util/util.c
> > > @@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)
> > >  	tcsetattr(0, TCSANOW, &tc);
> > >  }
> > >  
> > > -static void set_tracing_events_path(const char *tracing, const char *mountpoint)
> > > +static void tracing_path_set(const char *tracing, const char *mountpoint)
> > >  {
> > >  	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
> > >  		 mountpoint, tracing);
> > > @@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
> > >  		 mountpoint, tracing, "events");
> > >  }
> > >  
> > > -static const char *__perf_tracefs_mount(const char *mountpoint)
> > > +static const char *tracing_path_tracefs_mount(const char *mountpoint)
> > >  {
> > >  	const char *mnt;
> > >  
> > > @@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(const char *mountpoint)
> > >  	if (!mnt)
> > >  		return NULL;
> > >  
> > > -	set_tracing_events_path("", mnt);
> > > +	tracing_path_set("", mnt);
> > >  
> > >  	return mnt;
> > >  }
> > >  
> > > -static const char *__perf_debugfs_mount(const char *mountpoint)
> > > +static const char *tracing_path_debugfs_mount(const char *mountpoint)
> > >  {
> > >  	const char *mnt;
> > >  
> > > @@ -419,30 +419,30 @@ static const char *__perf_debugfs_mount(const char *mountpoint)
> > >  	if (!mnt)
> > >  		return NULL;
> > >  
> > > -	set_tracing_events_path("tracing/", mnt);
> > > +	tracing_path_set("tracing/", mnt);
> > >  
> > >  	return mnt;
> > >  }
> > >  
> > > -const char *perf_debugfs_mount(const char *mountpoint)
> > > +const char *perf_tracing_path_mount(const char *mountpoint)
> > >  {
> > >  	const char *mnt;
> > >  
> > > -	mnt = __perf_tracefs_mount(mountpoint);
> > > +	mnt = tracing_path_tracefs_mount(mountpoint);
> > >  	if (mnt)
> > >  		return mnt;
> > >  
> > > -	mnt = __perf_debugfs_mount(mountpoint);
> > > +	mnt = tracing_path_debugfs_mount(mountpoint);
> > >  
> > >  	return mnt;
> > >  }
> > >  
> > > -void perf_debugfs_set_path(const char *mntpt)
> > > +void perf_tracing_path_set(const char *mntpt)
> > >  {
> > > -	set_tracing_events_path("tracing/", mntpt);
> > > +	tracing_path_set("tracing/", mntpt);
> > >  }
> > >  
> > > -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename)
> > > +int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename)
> > >  {
> > >  	char sbuf[128];
> > >  
> > > @@ -485,13 +485,13 @@ int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename
> > >  	return 0;
> > >  }
> > >  
> > > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> > > +int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
> > >  {
> > >  	char path[PATH_MAX];
> > >  
> > >  	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
> > >  
> > > -	return debugfs__strerror_open(err, buf, size, path);
> > > +	return tracing_path_strerror_open(err, buf, size, path);
> > >  }
> > >  
> > >  char *get_tracing_file(const char *name)
> > > diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> > > index da48c00ab0db..34a68faf53fe 100644
> > > --- a/tools/perf/util/util.h
> > > +++ b/tools/perf/util/util.h
> > > @@ -85,10 +85,10 @@ extern const char *graph_dotted_line;
> > >  extern char buildid_dir[];
> > >  extern char tracing_path[];
> > >  extern char tracing_events_path[];
> > > -extern void perf_debugfs_set_path(const char *mountpoint);
> > > -const char *perf_debugfs_mount(const char *mountpoint);
> > > -int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
> > > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> > > +extern void perf_tracing_path_set(const char *mountpoint);
> > > +const char *perf_tracing_path_mount(const char *mountpoint);
> > > +int tracing_path_strerror_open(int err, char *buf, size_t size, const char *filename);
> > > +int tracing_path_strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
> > >  char *get_tracing_file(const char *name);
> > >  void put_tracing_file(char *file);
> > >  
> > > -- 
> > > 2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1213948 — Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromJiri Olsa <jolsa@redhat.com>
Date2015-08-26 17:10 +0200
SubjectRe: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q1KuR-Rx-3@gated-at.bofh.it>
In reply to#1213941
On Wed, Aug 26, 2015 at 11:58:55AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Aug 26, 2015 at 04:48:36PM +0200, Jiri Olsa escreveu:
> > On Wed, Aug 26, 2015 at 11:42:11AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Aug 26, 2015 at 03:46:47PM +0200, Jiri Olsa escreveu:
> > > > Renaming all functions touching tracing_path under same
> > > > namespace. New interface is:
> > > 
> > > But we were trying to have debugfs stuff in tools/lib/api/fs/, so that
> > > it could eventually be used by some other tools, etc, and now we're
> > > going the other way around, de-librarifying, not good :-\
> > 
> > well this gathers tracefs/debugfs together, the api/fs/{trace|debug}fs
> > are just building blocks
> > 
> > I only moved the debugfs__strerror_open_tp out of the debugfs object
> > because it needs to be one layer up, because it needs to touch tracefs
> > as well
> 
> Why not leave it there, since, for historical reasons, what is tracefs
> now was something implemented inside debugfs, so having that special
> case in debugfs__strerror_open_tp():
> 
>                 if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
> 
> Is ok, since tools will need to deal with older kernels, etc.
> 
> But ok, I see your point, we should rename it to something like
> tracepoint__strerror_open_definition(), so as to detach this from
> "debugfs" _and_ "tracefs", pseudo-filesystem based DWARF-like stuff
> (event definitions), but then why not have that somewhere in
> tools/lib/api/tracepoint/.

no problem with moving it over to the lib

how about having api/fs/tpfs
                 or     eventsfs
                 or     tracingfs


doing the same as tracing_path* stuff ATM

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

[toc] | [prev] | [next] | [standalone]


#1215331 — Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2015-08-28 15:10 +0200
SubjectRe: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q2rzP-49f-15@gated-at.bofh.it>
In reply to#1213948
On Wed, 26 Aug, at 05:06:37PM, Jiri Olsa wrote:
> 
> no problem with moving it over to the lib
> 
> how about having api/fs/tpfs
>                  or     eventsfs
>                  or     tracingfs
> 
> 
> doing the same as tracing_path* stuff ATM

But we're talking about tracing path components here right and not a
file system? It'd make more sense to me to have this logically above
the file system layers.

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

[toc] | [prev] | [next] | [standalone]


#1216069 — Re: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace

FromJiri Olsa <jolsa@redhat.com>
Date2015-08-31 09:50 +0200
SubjectRe: [PATCH 05/11] perf tools: Move tracing_path stuff under same namespace
Message-ID<q3s0O-1fK-15@gated-at.bofh.it>
In reply to#1215331
On Fri, Aug 28, 2015 at 02:06:50PM +0100, Matt Fleming wrote:
> On Wed, 26 Aug, at 05:06:37PM, Jiri Olsa wrote:
> > 
> > no problem with moving it over to the lib
> > 
> > how about having api/fs/tpfs
> >                  or     eventsfs
> >                  or     tracingfs
> > 
> > 
> > doing the same as tracing_path* stuff ATM
> 
> But we're talking about tracing path components here right and not a
> file system? It'd make more sense to me to have this logically above
> the file system layers.

right, on the other side it's fs related.. just holder
for preffered place to read tracepoints from

I dont have strong opinion on where to place it,
but I dont see better place.. fs/tracing_path.c ?

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web