diff options
Diffstat (limited to 'tools/perf/perf.c')
-rw-r--r-- | tools/perf/perf.c | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 9cafe5463266..89b82acac7d9 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "util/run-command.h" | 14 | #include "util/run-command.h" |
15 | #include "util/parse-events.h" | 15 | #include "util/parse-events.h" |
16 | #include "util/string.h" | 16 | #include "util/string.h" |
17 | #include "util/debugfs.h" | ||
17 | 18 | ||
18 | const char perf_usage_string[] = | 19 | const char perf_usage_string[] = |
19 | "perf [--version] [--help] COMMAND [ARGS]"; | 20 | "perf [--version] [--help] COMMAND [ARGS]"; |
@@ -286,8 +287,10 @@ static void handle_internal_command(int argc, const char **argv) | |||
286 | static struct cmd_struct commands[] = { | 287 | static struct cmd_struct commands[] = { |
287 | { "help", cmd_help, 0 }, | 288 | { "help", cmd_help, 0 }, |
288 | { "list", cmd_list, 0 }, | 289 | { "list", cmd_list, 0 }, |
290 | { "buildid-list", cmd_buildid_list, 0 }, | ||
289 | { "record", cmd_record, 0 }, | 291 | { "record", cmd_record, 0 }, |
290 | { "report", cmd_report, 0 }, | 292 | { "report", cmd_report, 0 }, |
293 | { "bench", cmd_bench, 0 }, | ||
291 | { "stat", cmd_stat, 0 }, | 294 | { "stat", cmd_stat, 0 }, |
292 | { "timechart", cmd_timechart, 0 }, | 295 | { "timechart", cmd_timechart, 0 }, |
293 | { "top", cmd_top, 0 }, | 296 | { "top", cmd_top, 0 }, |
@@ -383,45 +386,12 @@ static int run_argv(int *argcp, const char ***argv) | |||
383 | /* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */ | 386 | /* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */ |
384 | static void get_debugfs_mntpt(void) | 387 | static void get_debugfs_mntpt(void) |
385 | { | 388 | { |
386 | FILE *file; | 389 | const char *path = debugfs_find_mountpoint(); |
387 | char fs_type[100]; | ||
388 | char debugfs[MAXPATHLEN]; | ||
389 | 390 | ||
390 | /* | 391 | if (path) |
391 | * try the standard location | 392 | strncpy(debugfs_mntpt, path, sizeof(debugfs_mntpt)); |
392 | */ | 393 | else |
393 | if (valid_debugfs_mount("/sys/kernel/debug/") == 0) { | 394 | debugfs_mntpt[0] = '\0'; |
394 | strcpy(debugfs_mntpt, "/sys/kernel/debug/"); | ||
395 | return; | ||
396 | } | ||
397 | |||
398 | /* | ||
399 | * try the sane location | ||
400 | */ | ||
401 | if (valid_debugfs_mount("/debug/") == 0) { | ||
402 | strcpy(debugfs_mntpt, "/debug/"); | ||
403 | return; | ||
404 | } | ||
405 | |||
406 | /* | ||
407 | * give up and parse /proc/mounts | ||
408 | */ | ||
409 | file = fopen("/proc/mounts", "r"); | ||
410 | if (file == NULL) | ||
411 | return; | ||
412 | |||
413 | while (fscanf(file, "%*s %" | ||
414 | STR(MAXPATHLEN) | ||
415 | "s %99s %*s %*d %*d\n", | ||
416 | debugfs, fs_type) == 2) { | ||
417 | if (strcmp(fs_type, "debugfs") == 0) | ||
418 | break; | ||
419 | } | ||
420 | fclose(file); | ||
421 | if (strcmp(fs_type, "debugfs") == 0) { | ||
422 | strncpy(debugfs_mntpt, debugfs, MAXPATHLEN); | ||
423 | debugfs_mntpt[MAXPATHLEN - 1] = '\0'; | ||
424 | } | ||
425 | } | 395 | } |
426 | 396 | ||
427 | int main(int argc, const char **argv) | 397 | int main(int argc, const char **argv) |