aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-09-02 03:56:33 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-09-02 15:30:47 -0400
commit65d4b265103a3cb2f0993c946815157a38797421 (patch)
treec5019911c8c3a907b7a701ad83418e81116dd580 /tools
parentf6a09af7de3b39b1e4fcff7374871f834498b7f0 (diff)
perf tools: Move tracing_path stuff under same namespace
Renaming all functions touching tracing_path under same namespace. New interface is: char tracing_path[]; - tracing mount path char tracing_events_path[]; - tracing mount/events path void tracing_path_set(const char *mountpoint); - setting directly tracing_path(_events), used by --debugfs-dir option const char *tracing_path_mount(void); - initial setup of tracing_(events)_path, called from perf.c mounts debugfs/tracefs if needed and possible char *get_tracing_file(const char *name); void put_tracing_file(char *file); - get/put tracing file path 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> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1441180605-24737-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/perf.c10
-rw-r--r--tools/perf/util/util.c20
-rw-r--r--tools/perf/util/util.h4
3 files changed, 18 insertions, 16 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index f500a4b40722..0e99cd1de9dd 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)
214 fprintf(stderr, "No directory given for --debugfs-dir.\n"); 214 fprintf(stderr, "No directory given for --debugfs-dir.\n");
215 usage(perf_usage_string); 215 usage(perf_usage_string);
216 } 216 }
217 perf_debugfs_set_path((*argv)[1]); 217 tracing_path_set((*argv)[1]);
218 if (envchanged) 218 if (envchanged)
219 *envchanged = 1; 219 *envchanged = 1;
220 (*argv)++; 220 (*argv)++;
@@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
230 (*argv)++; 230 (*argv)++;
231 (*argc)--; 231 (*argc)--;
232 } else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) { 232 } else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
233 perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR)); 233 tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
234 fprintf(stderr, "dir: %s\n", tracing_path); 234 fprintf(stderr, "dir: %s\n", tracing_path);
235 if (envchanged) 235 if (envchanged)
236 *envchanged = 1; 236 *envchanged = 1;
@@ -517,8 +517,10 @@ int main(int argc, const char **argv)
517 cmd = perf_extract_argv0_path(argv[0]); 517 cmd = perf_extract_argv0_path(argv[0]);
518 if (!cmd) 518 if (!cmd)
519 cmd = "perf-help"; 519 cmd = "perf-help";
520 /* get debugfs mount point from /proc/mounts */ 520
521 perf_debugfs_mount(); 521 /* get debugfs/tracefs mount point from /proc/mounts */
522 tracing_path_mount();
523
522 /* 524 /*
523 * "perf-xxxx" is the same as "perf xxxx", but we obviously: 525 * "perf-xxxx" is the same as "perf xxxx", but we obviously:
524 * 526 *
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 74f71f8afcc2..b959f783f6cd 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)
390 tcsetattr(0, TCSANOW, &tc); 390 tcsetattr(0, TCSANOW, &tc);
391} 391}
392 392
393static void set_tracing_events_path(const char *tracing, const char *mountpoint) 393static void __tracing_path_set(const char *tracing, const char *mountpoint)
394{ 394{
395 snprintf(tracing_path, sizeof(tracing_path), "%s/%s", 395 snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
396 mountpoint, tracing); 396 mountpoint, tracing);
@@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint)
398 mountpoint, tracing, "events"); 398 mountpoint, tracing, "events");
399} 399}
400 400
401static const char *__perf_tracefs_mount(void) 401static const char *tracing_path_tracefs_mount(void)
402{ 402{
403 const char *mnt; 403 const char *mnt;
404 404
@@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(void)
406 if (!mnt) 406 if (!mnt)
407 return NULL; 407 return NULL;
408 408
409 set_tracing_events_path("", mnt); 409 __tracing_path_set("", mnt);
410 410
411 return mnt; 411 return mnt;
412} 412}
413 413
414static const char *__perf_debugfs_mount(void) 414static const char *tracing_path_debugfs_mount(void)
415{ 415{
416 const char *mnt; 416 const char *mnt;
417 417
@@ -419,27 +419,27 @@ static const char *__perf_debugfs_mount(void)
419 if (!mnt) 419 if (!mnt)
420 return NULL; 420 return NULL;
421 421
422 set_tracing_events_path("tracing/", mnt); 422 __tracing_path_set("tracing/", mnt);
423 423
424 return mnt; 424 return mnt;
425} 425}
426 426
427const char *perf_debugfs_mount(void) 427const char *tracing_path_mount(void)
428{ 428{
429 const char *mnt; 429 const char *mnt;
430 430
431 mnt = __perf_tracefs_mount(); 431 mnt = tracing_path_tracefs_mount();
432 if (mnt) 432 if (mnt)
433 return mnt; 433 return mnt;
434 434
435 mnt = __perf_debugfs_mount(); 435 mnt = tracing_path_debugfs_mount();
436 436
437 return mnt; 437 return mnt;
438} 438}
439 439
440void perf_debugfs_set_path(const char *mntpt) 440void tracing_path_set(const char *mntpt)
441{ 441{
442 set_tracing_events_path("tracing/", mntpt); 442 __tracing_path_set("tracing/", mntpt);
443} 443}
444 444
445char *get_tracing_file(const char *name) 445char *get_tracing_file(const char *name)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 48ec232b6f66..bbf8a937d780 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -85,8 +85,8 @@ extern const char *graph_dotted_line;
85extern char buildid_dir[]; 85extern char buildid_dir[];
86extern char tracing_path[]; 86extern char tracing_path[];
87extern char tracing_events_path[]; 87extern char tracing_events_path[];
88extern void perf_debugfs_set_path(const char *mountpoint); 88extern void tracing_path_set(const char *mountpoint);
89const char *perf_debugfs_mount(void); 89const char *tracing_path_mount(void);
90char *get_tracing_file(const char *name); 90char *get_tracing_file(const char *name);
91void put_tracing_file(char *file); 91void put_tracing_file(char *file);
92 92