Skip to contentSkip to conversation

perf tools: Add gtk.<command> config option for launching GTK browser

PATCH In review Namhyung Kim 3 participants 3 messages Nov 12, 2012 – Dec 8, 2012 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf tools: Add gtk.<command> config option for launching GTK browser

From: Namhyung Kim <[email protected]>

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
---
 tools/perf/perf.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
tools/perf/perf.c +10 -5
index a0ae2902f9c9..0f661fbce6a8 100644
@@ -85,21 +85,26 @@ int check_pager_config(const char *cmd)
 	return c.val;
 }
 
-static int tui_command_config(const char *var, const char *value, void *data)
+static int browser_command_config(const char *var, const char *value, void *data)
 {
 	struct pager_config *c = data;
 	if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd))
 		c->val = perf_config_bool(var, value);
+	if (!prefixcmp(var, "gtk.") && !strcmp(var + 4, c->cmd))
+		c->val = perf_config_bool(var, value) ? 2 : 0;
 	return 0;
 }
 
-/* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */
-static int check_tui_config(const char *cmd)
+/*
+ * returns 0 for "no tui", 1 for "use tui", 2 for "use gtk",
+ * and -1 for "not specified"
+ */
+static int check_browser_config(const char *cmd)
 {
 	struct pager_config c;
 	c.cmd = cmd;
 	c.val = -1;
-	perf_config(tui_command_config, &c);
+	perf_config(browser_command_config, &c);
 	return c.val;
 }
 
@@ -302,7 +307,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 		prefix = NULL; /* setup_perf_directory(); */
 
 	if (use_browser == -1)
-		use_browser = check_tui_config(p->cmd);
+		use_browser = check_browser_config(p->cmd);
 
 	if (use_pager == -1 && p->option & RUN_SETUP)
 		use_pager = check_pager_config(p->cmd);
Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

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).

Quoted 6 lines
$ cat ~/.perfconfig
[gtk]
report = true
#2 lore raw
In reply to Namhyung Kim
Commit-ID:  0020ce23864d16f66e5667013b8b43d1df3e142e
Gitweb:     http://git.kernel.org/tip/0020ce23864d16f66e5667013b8b43d1df3e142e
Author:     Namhyung Kim <[email protected]>
AuthorDate: Mon, 12 Nov 2012 11:50:17 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 14 Nov 2012 16:51:30 -0300

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
---
 tools/perf/perf.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
tools/perf/perf.c +10 -5
index a0ae290..0f661fb 100644
@@ -85,21 +85,26 @@ int check_pager_config(const char *cmd)
 	return c.val;
 }
 
-static int tui_command_config(const char *var, const char *value, void *data)
+static int browser_command_config(const char *var, const char *value, void *data)
 {
 	struct pager_config *c = data;
 	if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd))
 		c->val = perf_config_bool(var, value);
+	if (!prefixcmp(var, "gtk.") && !strcmp(var + 4, c->cmd))
+		c->val = perf_config_bool(var, value) ? 2 : 0;
 	return 0;
 }
 
-/* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */
-static int check_tui_config(const char *cmd)
+/*
+ * returns 0 for "no tui", 1 for "use tui", 2 for "use gtk",
+ * and -1 for "not specified"
+ */
+static int check_browser_config(const char *cmd)
 {
 	struct pager_config c;
 	c.cmd = cmd;
 	c.val = -1;
-	perf_config(tui_command_config, &c);
+	perf_config(browser_command_config, &c);
 	return c.val;
 }
 
@@ -302,7 +307,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 		prefix = NULL; /* setup_perf_directory(); */
 
 	if (use_browser == -1)
-		use_browser = check_tui_config(p->cmd);
+		use_browser = check_browser_config(p->cmd);
 
 	if (use_pager == -1 && p->option & RUN_SETUP)
 		use_pager = check_pager_config(p->cmd);