perf.c (ed45752061be11a40f57df4304296147dbda2da9) perf.c (7335399a6a4bead9ef8b59ce7d811fc4e99ca98c)
1/*
2 * perf.c
3 *
4 * Performance analysis utility.
5 *
6 * This is the main hub from which the sub-commands (perf stat,
7 * perf top, perf record, perf report, etc.) are started.
8 */
9#include "builtin.h"
10
11#include "util/exec_cmd.h"
12#include "util/cache.h"
13#include "util/quote.h"
14#include "util/run-command.h"
15#include "util/parse-events.h"
1/*
2 * perf.c
3 *
4 * Performance analysis utility.
5 *
6 * This is the main hub from which the sub-commands (perf stat,
7 * perf top, perf record, perf report, etc.) are started.
8 */
9#include "builtin.h"
10
11#include "util/exec_cmd.h"
12#include "util/cache.h"
13#include "util/quote.h"
14#include "util/run-command.h"
15#include "util/parse-events.h"
16#include "util/parse-options.h"
16#include "util/debug.h"
17#include <api/fs/debugfs.h>
18#include <pthread.h>
19
20const char perf_usage_string[] =
21 "perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
22
23const char perf_more_info_string[] =

--- 96 unchanged lines hidden (view full) ---

120 case 1:
121 /* setup_pager(); */
122 break;
123 default:
124 break;
125 }
126}
127
17#include "util/debug.h"
18#include <api/fs/debugfs.h>
19#include <pthread.h>
20
21const char perf_usage_string[] =
22 "perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
23
24const char perf_more_info_string[] =

--- 96 unchanged lines hidden (view full) ---

121 case 1:
122 /* setup_pager(); */
123 break;
124 default:
125 break;
126 }
127}
128
129struct option options[] = {
130 OPT_ARGUMENT("help", "help"),
131 OPT_ARGUMENT("version", "version"),
132 OPT_ARGUMENT("exec-path", "exec-path"),
133 OPT_ARGUMENT("html-path", "html-path"),
134 OPT_ARGUMENT("paginate", "paginate"),
135 OPT_ARGUMENT("no-pager", "no-pager"),
136 OPT_ARGUMENT("perf-dir", "perf-dir"),
137 OPT_ARGUMENT("work-tree", "work-tree"),
138 OPT_ARGUMENT("debugfs-dir", "debugfs-dir"),
139 OPT_ARGUMENT("buildid-dir", "buildid-dir"),
140 OPT_ARGUMENT("list-cmds", "list-cmds"),
141 OPT_ARGUMENT("list-opts", "list-opts"),
142 OPT_ARGUMENT("debug", "debug"),
143 OPT_END()
144};
145
128static int handle_options(const char ***argv, int *argc, int *envchanged)
129{
130 int handled = 0;
131
132 while (*argc > 0) {
133 const char *cmd = (*argv)[0];
134 if (cmd[0] != '-')
135 break;

--- 84 unchanged lines hidden (view full) ---

220 unsigned int i;
221
222 for (i = 0; i < ARRAY_SIZE(commands); i++) {
223 struct cmd_struct *p = commands+i;
224 printf("%s ", p->cmd);
225 }
226 putchar('\n');
227 exit(0);
146static int handle_options(const char ***argv, int *argc, int *envchanged)
147{
148 int handled = 0;
149
150 while (*argc > 0) {
151 const char *cmd = (*argv)[0];
152 if (cmd[0] != '-')
153 break;

--- 84 unchanged lines hidden (view full) ---

238 unsigned int i;
239
240 for (i = 0; i < ARRAY_SIZE(commands); i++) {
241 struct cmd_struct *p = commands+i;
242 printf("%s ", p->cmd);
243 }
244 putchar('\n');
245 exit(0);
246 } else if (!strcmp(cmd, "--list-opts")) {
247 unsigned int i;
248
249 for (i = 0; i < ARRAY_SIZE(options)-1; i++) {
250 struct option *p = options+i;
251 printf("--%s ", p->long_name);
252 }
253 putchar('\n');
254 exit(0);
228 } else if (!strcmp(cmd, "--debug")) {
229 if (*argc < 2) {
230 fprintf(stderr, "No variable specified for --debug.\n");
231 usage(perf_usage_string);
232 }
233 if (perf_debug_option((*argv)[1]))
234 usage(perf_usage_string);
235

--- 348 unchanged lines hidden ---
255 } else if (!strcmp(cmd, "--debug")) {
256 if (*argc < 2) {
257 fprintf(stderr, "No variable specified for --debug.\n");
258 usage(perf_usage_string);
259 }
260 if (perf_debug_option((*argv)[1]))
261 usage(perf_usage_string);
262

--- 348 unchanged lines hidden ---