diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-06-26 03:14:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-12 12:46:00 -0400 |
commit | 167aedc44e1743777e6aee71b0fe7ed94c6298cd (patch) | |
tree | b569ee7287d043bef618b4c6f86ab71ff9db8389 /tools/perf/util/trace-event-info.c | |
parent | fa1531fdd7b6332aa61bcc9fda495583acba460d (diff) |
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>
Diffstat (limited to 'tools/perf/util/trace-event-info.c')
-rw-r--r-- | tools/perf/util/trace-event-info.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 3917eb9a8479..615c0628678b 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c | |||
@@ -46,65 +46,6 @@ | |||
46 | static int output_fd; | 46 | static int output_fd; |
47 | 47 | ||
48 | 48 | ||
49 | static const char *find_debugfs(void) | ||
50 | { | ||
51 | const char *path = perf_debugfs_mount(NULL); | ||
52 | |||
53 | if (!path) | ||
54 | pr_debug("Your kernel does not support the debugfs filesystem"); | ||
55 | |||
56 | return path; | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * Finds the path to the debugfs/tracing | ||
61 | * Allocates the string and stores it. | ||
62 | */ | ||
63 | static const char *find_tracing_dir(void) | ||
64 | { | ||
65 | static char *tracing; | ||
66 | static int tracing_found; | ||
67 | const char *debugfs; | ||
68 | |||
69 | if (tracing_found) | ||
70 | return tracing; | ||
71 | |||
72 | debugfs = find_debugfs(); | ||
73 | if (!debugfs) | ||
74 | return NULL; | ||
75 | |||
76 | tracing = malloc(strlen(debugfs) + 9); | ||
77 | if (!tracing) | ||
78 | return NULL; | ||
79 | |||
80 | sprintf(tracing, "%s/tracing", debugfs); | ||
81 | |||
82 | tracing_found = 1; | ||
83 | return tracing; | ||
84 | } | ||
85 | |||
86 | static char *get_tracing_file(const char *name) | ||
87 | { | ||
88 | const char *tracing; | ||
89 | char *file; | ||
90 | |||
91 | tracing = find_tracing_dir(); | ||
92 | if (!tracing) | ||
93 | return NULL; | ||
94 | |||
95 | file = malloc(strlen(tracing) + strlen(name) + 2); | ||
96 | if (!file) | ||
97 | return NULL; | ||
98 | |||
99 | sprintf(file, "%s/%s", tracing, name); | ||
100 | return file; | ||
101 | } | ||
102 | |||
103 | static void put_tracing_file(char *file) | ||
104 | { | ||
105 | free(file); | ||
106 | } | ||
107 | |||
108 | int bigendian(void) | 49 | int bigendian(void) |
109 | { | 50 | { |
110 | unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0}; | 51 | unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0}; |