diff options
Diffstat (limited to 'tools/perf/perf.c')
| -rw-r--r-- | tools/perf/perf.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 873e55fab375..57cb107c1f13 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
| @@ -48,7 +48,8 @@ int check_pager_config(const char *cmd) | |||
| 48 | return c.val; | 48 | return c.val; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static void commit_pager_choice(void) { | 51 | static void commit_pager_choice(void) |
| 52 | { | ||
| 52 | switch (use_pager) { | 53 | switch (use_pager) { |
| 53 | case 0: | 54 | case 0: |
| 54 | setenv("PERF_PAGER", "cat", 1); | 55 | setenv("PERF_PAGER", "cat", 1); |
| @@ -70,7 +71,7 @@ static void set_debugfs_path(void) | |||
| 70 | "tracing/events"); | 71 | "tracing/events"); |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | static int handle_options(const char*** argv, int* argc, int* envchanged) | 74 | static int handle_options(const char ***argv, int *argc, int *envchanged) |
| 74 | { | 75 | { |
| 75 | int handled = 0; | 76 | int handled = 0; |
| 76 | 77 | ||
| @@ -109,7 +110,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged) | |||
| 109 | *envchanged = 1; | 110 | *envchanged = 1; |
| 110 | } else if (!strcmp(cmd, "--perf-dir")) { | 111 | } else if (!strcmp(cmd, "--perf-dir")) { |
| 111 | if (*argc < 2) { | 112 | if (*argc < 2) { |
| 112 | fprintf(stderr, "No directory given for --perf-dir.\n" ); | 113 | fprintf(stderr, "No directory given for --perf-dir.\n"); |
| 113 | usage(perf_usage_string); | 114 | usage(perf_usage_string); |
| 114 | } | 115 | } |
| 115 | setenv(PERF_DIR_ENVIRONMENT, (*argv)[1], 1); | 116 | setenv(PERF_DIR_ENVIRONMENT, (*argv)[1], 1); |
| @@ -124,7 +125,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged) | |||
| 124 | *envchanged = 1; | 125 | *envchanged = 1; |
| 125 | } else if (!strcmp(cmd, "--work-tree")) { | 126 | } else if (!strcmp(cmd, "--work-tree")) { |
| 126 | if (*argc < 2) { | 127 | if (*argc < 2) { |
| 127 | fprintf(stderr, "No directory given for --work-tree.\n" ); | 128 | fprintf(stderr, "No directory given for --work-tree.\n"); |
| 128 | usage(perf_usage_string); | 129 | usage(perf_usage_string); |
| 129 | } | 130 | } |
| 130 | setenv(PERF_WORK_TREE_ENVIRONMENT, (*argv)[1], 1); | 131 | setenv(PERF_WORK_TREE_ENVIRONMENT, (*argv)[1], 1); |
| @@ -168,7 +169,7 @@ static int handle_alias(int *argcp, const char ***argv) | |||
| 168 | { | 169 | { |
| 169 | int envchanged = 0, ret = 0, saved_errno = errno; | 170 | int envchanged = 0, ret = 0, saved_errno = errno; |
| 170 | int count, option_count; | 171 | int count, option_count; |
| 171 | const char** new_argv; | 172 | const char **new_argv; |
| 172 | const char *alias_command; | 173 | const char *alias_command; |
| 173 | char *alias_string; | 174 | char *alias_string; |
| 174 | 175 | ||
| @@ -210,11 +211,11 @@ static int handle_alias(int *argcp, const char ***argv) | |||
| 210 | if (!strcmp(alias_command, new_argv[0])) | 211 | if (!strcmp(alias_command, new_argv[0])) |
| 211 | die("recursive alias: %s", alias_command); | 212 | die("recursive alias: %s", alias_command); |
| 212 | 213 | ||
| 213 | new_argv = realloc(new_argv, sizeof(char*) * | 214 | new_argv = realloc(new_argv, sizeof(char *) * |
| 214 | (count + *argcp + 1)); | 215 | (count + *argcp + 1)); |
| 215 | /* insert after command name */ | 216 | /* insert after command name */ |
| 216 | memcpy(new_argv + count, *argv + 1, sizeof(char*) * *argcp); | 217 | memcpy(new_argv + count, *argv + 1, sizeof(char *) * *argcp); |
| 217 | new_argv[count+*argcp] = NULL; | 218 | new_argv[count + *argcp] = NULL; |
| 218 | 219 | ||
| 219 | *argv = new_argv; | 220 | *argv = new_argv; |
| 220 | *argcp += count - 1; | 221 | *argcp += count - 1; |
| @@ -285,6 +286,7 @@ static void handle_internal_command(int argc, const char **argv) | |||
| 285 | { | 286 | { |
| 286 | const char *cmd = argv[0]; | 287 | const char *cmd = argv[0]; |
| 287 | static struct cmd_struct commands[] = { | 288 | static struct cmd_struct commands[] = { |
| 289 | { "buildid-cache", cmd_buildid_cache, 0 }, | ||
| 288 | { "buildid-list", cmd_buildid_list, 0 }, | 290 | { "buildid-list", cmd_buildid_list, 0 }, |
| 289 | { "diff", cmd_diff, 0 }, | 291 | { "diff", cmd_diff, 0 }, |
| 290 | { "help", cmd_help, 0 }, | 292 | { "help", cmd_help, 0 }, |
| @@ -301,6 +303,7 @@ static void handle_internal_command(int argc, const char **argv) | |||
| 301 | { "sched", cmd_sched, 0 }, | 303 | { "sched", cmd_sched, 0 }, |
| 302 | { "probe", cmd_probe, 0 }, | 304 | { "probe", cmd_probe, 0 }, |
| 303 | { "kmem", cmd_kmem, 0 }, | 305 | { "kmem", cmd_kmem, 0 }, |
| 306 | { "lock", cmd_lock, 0 }, | ||
| 304 | }; | 307 | }; |
| 305 | unsigned int i; | 308 | unsigned int i; |
| 306 | static const char ext[] = STRIP_EXTENSION; | 309 | static const char ext[] = STRIP_EXTENSION; |
| @@ -388,7 +391,7 @@ static int run_argv(int *argcp, const char ***argv) | |||
| 388 | /* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */ | 391 | /* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */ |
| 389 | static void get_debugfs_mntpt(void) | 392 | static void get_debugfs_mntpt(void) |
| 390 | { | 393 | { |
| 391 | const char *path = debugfs_find_mountpoint(); | 394 | const char *path = debugfs_mount(NULL); |
| 392 | 395 | ||
| 393 | if (path) | 396 | if (path) |
| 394 | strncpy(debugfs_mntpt, path, sizeof(debugfs_mntpt)); | 397 | strncpy(debugfs_mntpt, path, sizeof(debugfs_mntpt)); |
| @@ -449,8 +452,8 @@ int main(int argc, const char **argv) | |||
| 449 | setup_path(); | 452 | setup_path(); |
| 450 | 453 | ||
| 451 | while (1) { | 454 | while (1) { |
| 452 | static int done_help = 0; | 455 | static int done_help; |
| 453 | static int was_alias = 0; | 456 | static int was_alias; |
| 454 | 457 | ||
| 455 | was_alias = run_argv(&argc, &argv); | 458 | was_alias = run_argv(&argc, &argv); |
| 456 | if (errno != ENOENT) | 459 | if (errno != ENOENT) |
