aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/perf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/perf.c')
-rw-r--r--tools/perf/perf.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 6d50eb0b4251..0f661fbce6a8 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -24,6 +24,7 @@ const char perf_more_info_string[] =
24 24
25int use_browser = -1; 25int use_browser = -1;
26static int use_pager = -1; 26static int use_pager = -1;
27const char *input_name;
27 28
28struct cmd_struct { 29struct cmd_struct {
29 const char *cmd; 30 const char *cmd;
@@ -84,21 +85,26 @@ int check_pager_config(const char *cmd)
84 return c.val; 85 return c.val;
85} 86}
86 87
87static int tui_command_config(const char *var, const char *value, void *data) 88static int browser_command_config(const char *var, const char *value, void *data)
88{ 89{
89 struct pager_config *c = data; 90 struct pager_config *c = data;
90 if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd)) 91 if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd))
91 c->val = perf_config_bool(var, value); 92 c->val = perf_config_bool(var, value);
93 if (!prefixcmp(var, "gtk.") && !strcmp(var + 4, c->cmd))
94 c->val = perf_config_bool(var, value) ? 2 : 0;
92 return 0; 95 return 0;
93} 96}
94 97
95/* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */ 98/*
96static int check_tui_config(const char *cmd) 99 * returns 0 for "no tui", 1 for "use tui", 2 for "use gtk",
100 * and -1 for "not specified"
101 */
102static int check_browser_config(const char *cmd)
97{ 103{
98 struct pager_config c; 104 struct pager_config c;
99 c.cmd = cmd; 105 c.cmd = cmd;
100 c.val = -1; 106 c.val = -1;
101 perf_config(tui_command_config, &c); 107 perf_config(browser_command_config, &c);
102 return c.val; 108 return c.val;
103} 109}
104 110
@@ -301,7 +307,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
301 prefix = NULL; /* setup_perf_directory(); */ 307 prefix = NULL; /* setup_perf_directory(); */
302 308
303 if (use_browser == -1) 309 if (use_browser == -1)
304 use_browser = check_tui_config(p->cmd); 310 use_browser = check_browser_config(p->cmd);
305 311
306 if (use_pager == -1 && p->option & RUN_SETUP) 312 if (use_pager == -1 && p->option & RUN_SETUP)
307 use_pager = check_pager_config(p->cmd); 313 use_pager = check_pager_config(p->cmd);
@@ -440,6 +446,8 @@ int main(int argc, const char **argv)
440{ 446{
441 const char *cmd; 447 const char *cmd;
442 448
449 page_size = sysconf(_SC_PAGE_SIZE);
450
443 cmd = perf_extract_argv0_path(argv[0]); 451 cmd = perf_extract_argv0_path(argv[0]);
444 if (!cmd) 452 if (!cmd)
445 cmd = "perf-help"; 453 cmd = "perf-help";
@@ -481,6 +489,8 @@ int main(int argc, const char **argv)
481 } 489 }
482 cmd = argv[0]; 490 cmd = argv[0];
483 491
492 test_attr__init();
493
484 /* 494 /*
485 * We use PATH to find perf commands, but we prepend some higher 495 * We use PATH to find perf commands, but we prepend some higher
486 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH 496 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH