Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1213884 > unrolled thread
| Started by | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| First post | 2015-08-26 15:50 +0200 |
| Last post | 2015-08-31 10:40 +0200 |
| Articles | 5 — 5 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.
[PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions Jiri Olsa <jolsa@kernel.org> - 2015-08-26 15:50 +0200
Re: [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions Matt Fleming <matt@codeblueprint.co.uk> - 2015-08-28 00:50 +0200
Re: [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-28 18:30 +0200
Re: [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions Jiri Olsa <jolsa@redhat.com> - 2015-08-29 12:30 +0200
[tip:perf/core] perf tools: Add tracing_path and remove unneeded functions tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-08-31 10:40 +0200
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2015-08-26 15:50 +0200 |
| Subject | [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions |
| Message-ID | <q1Jfs-7l6-13@gated-at.bofh.it> |
There's no need for find_tracing_dir, because perf already
searches for debugfs/tracefs mount on start and populate
tracing_events_path.
Adding tracing_path to carry tracing dir string to be used
in get_tracing_file instead of calling find_tracing_dir.
Link: http://lkml.kernel.org/n/tip-2ji655gnw2pspo9o8u8aghic@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/util.c | 56 ++++----------------------------------------------
tools/perf/util/util.h | 2 +-
2 files changed, 5 insertions(+), 53 deletions(-)
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index f7adf1203df1..d33c34196a5a 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -34,6 +34,7 @@ bool test_attr__enabled;
bool perf_host = true;
bool perf_guest = false;
+char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing";
char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
void event_attr_init(struct perf_event_attr *attr)
@@ -391,6 +392,8 @@ void set_term_quiet_input(struct termios *old)
static void set_tracing_events_path(const char *tracing, const char *mountpoint)
{
+ snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
+ mountpoint, tracing);
snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
mountpoint, tracing, "events");
}
@@ -440,62 +443,11 @@ void perf_debugfs_set_path(const char *mntpt)
set_tracing_events_path("tracing/", mntpt);
}
-static const char *find_tracefs(void)
-{
- const char *path = __perf_tracefs_mount(NULL);
-
- return path;
-}
-
-static const char *find_debugfs(void)
-{
- const char *path = __perf_debugfs_mount(NULL);
-
- if (!path)
- fprintf(stderr, "Your kernel does not support the debugfs filesystem");
-
- return path;
-}
-
-/*
- * Finds the path to the debugfs/tracing
- * Allocates the string and stores it.
- */
-const char *find_tracing_dir(void)
-{
- const char *tracing_dir = "";
- static char *tracing;
- static int tracing_found;
- const char *debugfs;
-
- if (tracing_found)
- return tracing;
-
- debugfs = find_tracefs();
- if (!debugfs) {
- tracing_dir = "/tracing";
- debugfs = find_debugfs();
- if (!debugfs)
- return NULL;
- }
-
- if (asprintf(&tracing, "%s%s", debugfs, tracing_dir) < 0)
- return NULL;
-
- tracing_found = 1;
- return tracing;
-}
-
char *get_tracing_file(const char *name)
{
- const char *tracing;
char *file;
- tracing = find_tracing_dir();
- if (!tracing)
- return NULL;
-
- if (asprintf(&file, "%s/%s", tracing, name) < 0)
+ if (asprintf(&file, "%s/%s", tracing_path, name) < 0)
return NULL;
return file;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 88a891562a47..291be1d84bc3 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -83,10 +83,10 @@
extern const char *graph_line;
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);
-const char *find_tracing_dir(void);
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]
| From | Matt Fleming <matt@codeblueprint.co.uk> |
|---|---|
| Date | 2015-08-28 00:50 +0200 |
| Subject | Re: [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions |
| Message-ID | <q2e9z-1mE-7@gated-at.bofh.it> |
| In reply to | #1213884 |
On Wed, 26 Aug, at 03:46:44PM, Jiri Olsa wrote: > There's no need for find_tracing_dir, because perf already > searches for debugfs/tracefs mount on start and populate > tracing_events_path. I'm getting a bit lost searching through the git history of these functions. Why is it safe to delete these functions? Where did the old user that required find_tracing_dir() to mount debugfs disappear to? The code to do the mount of debugfs/tracefs when perf starts appears to have been around for years. Is the mounting operation of find_tracing_dir() just dead code? -- 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]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-08-28 18:30 +0200 |
| Subject | Re: [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions |
| Message-ID | <q2uHp-7g-19@gated-at.bofh.it> |
| In reply to | #1214952 |
Em Thu, Aug 27, 2015 at 11:47:19PM +0100, Matt Fleming escreveu: > On Wed, 26 Aug, at 03:46:44PM, Jiri Olsa wrote: > > There's no need for find_tracing_dir, because perf already > > searches for debugfs/tracefs mount on start and populate > > tracing_events_path. > > I'm getting a bit lost searching through the git history of these > functions. Why is it safe to delete these functions? Where did the old > user that required find_tracing_dir() to mount debugfs disappear to? > > The code to do the mount of debugfs/tracefs when perf starts appears > to have been around for years. Is the mounting operation of > find_tracing_dir() just dead code? It looks like, these things should come after we realize that tracepoints were requested in record, so we already looked where things are mounted, etc, without digging deeper I think Jiri's patch is ok. - Arnaldo -- 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]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-08-29 12:30 +0200 |
| Subject | Re: [PATCH 02/11] perf tools: Add tracing_path and remove unneeded functions |
| Message-ID | <q2Lyy-7rp-19@gated-at.bofh.it> |
| In reply to | #1215436 |
On Fri, Aug 28, 2015 at 01:27:22PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Aug 27, 2015 at 11:47:19PM +0100, Matt Fleming escreveu: > > On Wed, 26 Aug, at 03:46:44PM, Jiri Olsa wrote: > > > There's no need for find_tracing_dir, because perf already > > > searches for debugfs/tracefs mount on start and populate > > > tracing_events_path. > > > > I'm getting a bit lost searching through the git history of these > > functions. Why is it safe to delete these functions? Where did the old > > user that required find_tracing_dir() to mount debugfs disappear to? > > > > The code to do the mount of debugfs/tracefs when perf starts appears > > to have been around for years. Is the mounting operation of > > find_tracing_dir() just dead code? yep, I'll address that in v2.. found TODO in fs.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] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2015-08-31 10:40 +0200 |
| Subject | [tip:perf/core] perf tools: Add tracing_path and remove unneeded functions |
| Message-ID | <q3sNb-2pJ-3@gated-at.bofh.it> |
| In reply to | #1213884 |
Commit-ID: 9f44f0cc1c32f1542071447a9493652bbc03facb
Gitweb: http://git.kernel.org/tip/9f44f0cc1c32f1542071447a9493652bbc03facb
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 26 Aug 2015 15:46:44 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 28 Aug 2015 14:53:51 -0300
perf tools: Add tracing_path and remove unneeded functions
There's no need for find_tracing_dir, because perf already searches for
debugfs/tracefs mount on start and populate tracing_events_path.
Adding tracing_path to carry tracing dir string to be used in
get_tracing_file instead of calling find_tracing_dir.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1440596813-12844-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/util.c | 56 ++++----------------------------------------------
tools/perf/util/util.h | 2 +-
2 files changed, 5 insertions(+), 53 deletions(-)
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index f7adf12..d33c341 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -34,6 +34,7 @@ bool test_attr__enabled;
bool perf_host = true;
bool perf_guest = false;
+char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing";
char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
void event_attr_init(struct perf_event_attr *attr)
@@ -391,6 +392,8 @@ void set_term_quiet_input(struct termios *old)
static void set_tracing_events_path(const char *tracing, const char *mountpoint)
{
+ snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
+ mountpoint, tracing);
snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
mountpoint, tracing, "events");
}
@@ -440,62 +443,11 @@ void perf_debugfs_set_path(const char *mntpt)
set_tracing_events_path("tracing/", mntpt);
}
-static const char *find_tracefs(void)
-{
- const char *path = __perf_tracefs_mount(NULL);
-
- return path;
-}
-
-static const char *find_debugfs(void)
-{
- const char *path = __perf_debugfs_mount(NULL);
-
- if (!path)
- fprintf(stderr, "Your kernel does not support the debugfs filesystem");
-
- return path;
-}
-
-/*
- * Finds the path to the debugfs/tracing
- * Allocates the string and stores it.
- */
-const char *find_tracing_dir(void)
-{
- const char *tracing_dir = "";
- static char *tracing;
- static int tracing_found;
- const char *debugfs;
-
- if (tracing_found)
- return tracing;
-
- debugfs = find_tracefs();
- if (!debugfs) {
- tracing_dir = "/tracing";
- debugfs = find_debugfs();
- if (!debugfs)
- return NULL;
- }
-
- if (asprintf(&tracing, "%s%s", debugfs, tracing_dir) < 0)
- return NULL;
-
- tracing_found = 1;
- return tracing;
-}
-
char *get_tracing_file(const char *name)
{
- const char *tracing;
char *file;
- tracing = find_tracing_dir();
- if (!tracing)
- return NULL;
-
- if (asprintf(&file, "%s/%s", tracing, name) < 0)
+ if (asprintf(&file, "%s/%s", tracing_path, name) < 0)
return NULL;
return file;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 88a8915..291be1d 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -83,10 +83,10 @@
extern const char *graph_line;
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);
-const char *find_tracing_dir(void);
char *get_tracing_file(const char *name);
void put_tracing_file(char *file);
--
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