From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
eranian@google.com, paulus@samba.org, hpa@zytor.com,
mingo@kernel.org, a.p.zijlstra@chello.nl, namhyung.kim@lge.com,
namhyung@kernel.org, jolsa@redhat.com, fweisbec@gmail.com,
rostedt@goodmis.org, dsahern@gmail.com, tglx@linutronix.de
Subject: [tip:perf/core] perf util: Move debugfs/ tracing helper functions to util.c
Date: Fri, 19 Jul 2013 00:43:58 -0700 [thread overview]
Message-ID: <tip-167aedc44e1743777e6aee71b0fe7ed94c6298cd@git.kernel.org> (raw)
In-Reply-To: <1372230862-15861-2-git-send-email-namhyung@kernel.org>
Commit-ID: 167aedc44e1743777e6aee71b0fe7ed94c6298cd
Gitweb: http://git.kernel.org/tip/167aedc44e1743777e6aee71b0fe7ed94c6298cd
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 26 Jun 2013 16:14:04 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 12 Jul 2013 13:46:00 -0300
perf util: Move debugfs/tracing helper functions to util.c
Since they're generic helpers move them to util.c so that they can be
used by others.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1372230862-15861-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/trace-event-info.c | 59 --------------------------------------
tools/perf/util/util.c | 59 ++++++++++++++++++++++++++++++++++++++
tools/perf/util/util.h | 3 ++
3 files changed, 62 insertions(+), 59 deletions(-)
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 3917eb9..615c062 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -46,65 +46,6 @@
static int output_fd;
-static const char *find_debugfs(void)
-{
- const char *path = perf_debugfs_mount(NULL);
-
- if (!path)
- pr_debug("Your kernel does not support the debugfs filesystem");
-
- return path;
-}
-
-/*
- * Finds the path to the debugfs/tracing
- * Allocates the string and stores it.
- */
-static const char *find_tracing_dir(void)
-{
- static char *tracing;
- static int tracing_found;
- const char *debugfs;
-
- if (tracing_found)
- return tracing;
-
- debugfs = find_debugfs();
- if (!debugfs)
- return NULL;
-
- tracing = malloc(strlen(debugfs) + 9);
- if (!tracing)
- return NULL;
-
- sprintf(tracing, "%s/tracing", debugfs);
-
- tracing_found = 1;
- return tracing;
-}
-
-static char *get_tracing_file(const char *name)
-{
- const char *tracing;
- char *file;
-
- tracing = find_tracing_dir();
- if (!tracing)
- return NULL;
-
- file = malloc(strlen(tracing) + strlen(name) + 2);
- if (!file)
- return NULL;
-
- sprintf(file, "%s/%s", tracing, name);
- return file;
-}
-
-static void put_tracing_file(char *file)
-{
- free(file);
-}
-
int bigendian(void)
{
unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0};
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 59d868a..9a06584 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -269,3 +269,62 @@ void perf_debugfs_set_path(const char *mntpt)
snprintf(debugfs_mountpoint, strlen(debugfs_mountpoint), "%s", mntpt);
set_tracing_events_path(mntpt);
}
+
+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)
+{
+ static char *tracing;
+ static int tracing_found;
+ const char *debugfs;
+
+ if (tracing_found)
+ return tracing;
+
+ debugfs = find_debugfs();
+ if (!debugfs)
+ return NULL;
+
+ tracing = malloc(strlen(debugfs) + 9);
+ if (!tracing)
+ return NULL;
+
+ sprintf(tracing, "%s/tracing", debugfs);
+
+ 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;
+
+ file = malloc(strlen(tracing) + strlen(name) + 2);
+ if (!file)
+ return NULL;
+
+ sprintf(file, "%s/%s", tracing, name);
+ return file;
+}
+
+void put_tracing_file(char *file)
+{
+ free(file);
+}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 2732fad..cc1574e 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -80,6 +80,9 @@ extern char buildid_dir[];
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);
/* On most systems <limits.h> would have given us this, but
* not on some systems (e.g. GNU/Hurd).
next prev parent reply other threads:[~2013-07-19 7:44 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 7:14 [PATCHSET 00/19] perf tools: Introduce new 'ftrace' command (v3) Namhyung Kim
2013-06-26 7:14 ` [PATCH 01/19] perf util: Move debugfs/tracing helper functions to util.c Namhyung Kim
2013-07-19 7:43 ` tip-bot for Namhyung Kim [this message]
2013-06-26 7:14 ` [PATCH 02/19] perf util: Use evsel->name to get tracepoint_paths Namhyung Kim
2013-07-19 7:44 ` [tip:perf/core] perf util: Use evsel-> name " tip-bot for Namhyung Kim
2013-06-26 7:14 ` [PATCH 03/19] perf util: Save pid-cmdline mapping into tracing header Namhyung Kim
2013-06-26 7:14 ` [PATCH 04/19] perf util: Add more debug message on failure path Namhyung Kim
2013-06-26 7:14 ` [PATCH 05/19] perf tools: Introduce new 'ftrace' tool Namhyung Kim
2013-06-26 17:10 ` David Ahern
2013-06-27 5:04 ` Namhyung Kim
2013-06-27 13:51 ` David Ahern
2013-06-27 14:22 ` Namhyung Kim
2013-06-26 7:14 ` [PATCH 06/19] perf ftrace: Add support for --pid option Namhyung Kim
2013-06-26 17:12 ` David Ahern
2013-06-27 5:23 ` Namhyung Kim
2013-06-27 13:56 ` David Ahern
2013-06-27 14:12 ` Namhyung Kim
2013-07-10 14:18 ` Jiri Olsa
2013-07-11 7:56 ` Namhyung Kim
2013-07-18 6:38 ` Namhyung Kim
2013-06-26 7:14 ` [PATCH 07/19] perf ftrace: Add support for -a and -C option Namhyung Kim
2013-06-26 7:14 ` [PATCH 08/19] perf ftrace: Split "live" sub-command Namhyung Kim
2013-06-26 7:14 ` [PATCH 09/19] perf ftrace: Add 'record' sub-command Namhyung Kim
2013-07-10 14:28 ` Jiri Olsa
2013-07-11 8:00 ` Namhyung Kim
2013-06-26 7:14 ` [PATCH 10/19] perf ftrace: Add 'show' sub-command Namhyung Kim
2013-07-10 14:41 ` Jiri Olsa
2013-07-11 8:01 ` Namhyung Kim
2013-06-26 7:14 ` [PATCH 11/19] perf ftrace: Add 'report' sub-command Namhyung Kim
2013-07-10 14:45 ` Jiri Olsa
2013-07-11 8:10 ` Namhyung Kim
2013-06-26 7:14 ` [PATCH 12/19] perf evlist: Enhance perf_evlist__start_workload() Namhyung Kim
2013-07-12 8:50 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2013-06-26 7:14 ` [PATCH 13/19] perf ftrace: Use pager for displaying result Namhyung Kim
2013-06-26 7:14 ` [PATCH 14/19] perf ftrace: Cleanup using ftrace_setup/teardown() Namhyung Kim
2013-06-26 7:14 ` [PATCH 15/19] perf tools: Add document for perf-ftrace command Namhyung Kim
2013-07-10 14:22 ` Jiri Olsa
2013-07-11 8:18 ` Namhyung Kim
2013-07-11 11:43 ` Jiri Olsa
2013-06-26 7:14 ` [PATCH 16/19] perf ftrace: Add a signal handler for SIGSEGV Namhyung Kim
2013-06-26 7:14 ` [PATCH 17/19] perf ftrace: Add --clock option Namhyung Kim
2013-06-26 7:14 ` [PATCH 18/19] perf ftrace: Show leaf-functions as oneliner Namhyung Kim
2013-06-26 7:14 ` [PATCH 19/19] perf ftrace: Tidy up the function graph output of 'show' subcommand Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-167aedc44e1743777e6aee71b0fe7ed94c6298cd@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox