diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-11-11 21:50:17 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-11-14 14:51:30 -0500 |
commit | 0020ce23864d16f66e5667013b8b43d1df3e142e (patch) | |
tree | 4d6a6d8cf7bc0c7bd34c20f7b583e706679dc5d0 /tools | |
parent | 4f746c95f18ad4d85599d9c157da7e6da766c3d9 (diff) |
perf tools: Add gtk.<command> config option for launching GTK browser
Add config option for launching GTK browser for the specified command by
default. Currently only 'report' command is supported.
Adding following line to the perfconfig file will have a same effect of
specifying --gtk option on command line (unless other related options
are not given).
$ cat ~/.perfconfig
[gtk]
report = true
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352688617-25570-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/perf.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index a0ae2902f9c9..0f661fbce6a8 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -85,21 +85,26 @@ int check_pager_config(const char *cmd) | |||
85 | return c.val; | 85 | return c.val; |
86 | } | 86 | } |
87 | 87 | ||
88 | static int tui_command_config(const char *var, const char *value, void *data) | 88 | static int browser_command_config(const char *var, const char *value, void *data) |
89 | { | 89 | { |
90 | struct pager_config *c = data; | 90 | struct pager_config *c = data; |
91 | if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd)) | 91 | if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd)) |
92 | 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; | ||
93 | return 0; | 95 | return 0; |
94 | } | 96 | } |
95 | 97 | ||
96 | /* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */ | 98 | /* |
97 | static 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 | */ | ||
102 | static int check_browser_config(const char *cmd) | ||
98 | { | 103 | { |
99 | struct pager_config c; | 104 | struct pager_config c; |
100 | c.cmd = cmd; | 105 | c.cmd = cmd; |
101 | c.val = -1; | 106 | c.val = -1; |
102 | perf_config(tui_command_config, &c); | 107 | perf_config(browser_command_config, &c); |
103 | return c.val; | 108 | return c.val; |
104 | } | 109 | } |
105 | 110 | ||
@@ -302,7 +307,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) | |||
302 | prefix = NULL; /* setup_perf_directory(); */ | 307 | prefix = NULL; /* setup_perf_directory(); */ |
303 | 308 | ||
304 | if (use_browser == -1) | 309 | if (use_browser == -1) |
305 | use_browser = check_tui_config(p->cmd); | 310 | use_browser = check_browser_config(p->cmd); |
306 | 311 | ||
307 | if (use_pager == -1 && p->option & RUN_SETUP) | 312 | if (use_pager == -1 && p->option & RUN_SETUP) |
308 | use_pager = check_pager_config(p->cmd); | 313 | use_pager = check_pager_config(p->cmd); |