- patches.arch/x86_mce_intel_decode_physical_address.patch:
[linux-flexiantxendom0-3.2.10.git] / tools / perf / perf.c
index cd32c20..6e48711 100644 (file)
@@ -13,7 +13,6 @@
 #include "util/quote.h"
 #include "util/run-command.h"
 #include "util/parse-events.h"
-#include "util/string.h"
 #include "util/debugfs.h"
 
 const char perf_usage_string[] =
@@ -22,7 +21,9 @@ const char perf_usage_string[] =
 const char perf_more_info_string[] =
        "See 'perf help COMMAND' for more information on a specific command.";
 
+int use_browser = -1;
 static int use_pager = -1;
+
 struct pager_config {
        const char *cmd;
        int val;
@@ -48,6 +49,24 @@ int check_pager_config(const char *cmd)
        return c.val;
 }
 
+static int tui_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);
+       return 0;
+}
+
+/* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */
+static int check_tui_config(const char *cmd)
+{
+       struct pager_config c;
+       c.cmd = cmd;
+       c.val = -1;
+       perf_config(tui_command_config, &c);
+       return c.val;
+}
+
 static void commit_pager_choice(void)
 {
        switch (use_pager) {
@@ -254,6 +273,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
        if (p->option & RUN_SETUP)
                prefix = NULL; /* setup_perf_directory(); */
 
+       if (use_browser == -1)
+               use_browser = check_tui_config(p->cmd);
+
        if (use_pager == -1 && p->option & RUN_SETUP)
                use_pager = check_pager_config(p->cmd);
        if (use_pager == -1 && p->option & USE_PAGER)
@@ -262,6 +284,8 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
        set_debugfs_path();
 
        status = p->fn(argc, argv, prefix);
+       exit_browser(status);
+
        if (status)
                return status & 0xff;
 
@@ -304,6 +328,9 @@ static void handle_internal_command(int argc, const char **argv)
                { "probe",      cmd_probe,      0 },
                { "kmem",       cmd_kmem,       0 },
                { "lock",       cmd_lock,       0 },
+               { "kvm",        cmd_kvm,        0 },
+               { "test",       cmd_test,       0 },
+               { "inject",     cmd_inject,     0 },
        };
        unsigned int i;
        static const char ext[] = STRIP_EXTENSION;