aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2013-02-03 01:38:21 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-02-06 16:09:25 -0500
commitad0de0971b7f7097bd9be1ab4ad2a64db500adbf (patch)
tree45d47634deedd22082fdb4c96a35c6e1bb4dfe24 /tools
parent341487ab561f3937a5283dd77c5660b1ee3b1f9e (diff)
perf report: Enable the runtime switching of perf data file
This is for tui browser only. This patch will check the returned key of tui hists browser, if it's K_SWITH_INPUT_DATA, then recreate a session for the new selected data file. V2: Move the setup_brower() before the "repeat" jump point. Signed-off-by: Feng Tang <feng.tang@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1359873501-24541-2-git-send-email-feng.tang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-report.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 0d221870561a..91555d4885f4 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -468,9 +468,17 @@ static int __cmd_report(struct perf_report *rep)
468 468
469 if (use_browser > 0) { 469 if (use_browser > 0) {
470 if (use_browser == 1) { 470 if (use_browser == 1) {
471 perf_evlist__tui_browse_hists(session->evlist, help, 471 ret = perf_evlist__tui_browse_hists(session->evlist,
472 NULL, 472 help,
473 &session->header.env); 473 NULL,
474 &session->header.env);
475 /*
476 * Usually "ret" is the last pressed key, and we only
477 * care if the key notifies us to switch data file.
478 */
479 if (ret != K_SWITCH_INPUT_DATA)
480 ret = 0;
481
474 } else if (use_browser == 2) { 482 } else if (use_browser == 2) {
475 perf_evlist__gtk_browse_hists(session->evlist, help, 483 perf_evlist__gtk_browse_hists(session->evlist, help,
476 NULL); 484 NULL);
@@ -708,6 +716,16 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
708 else 716 else
709 input_name = "perf.data"; 717 input_name = "perf.data";
710 } 718 }
719
720 if (strcmp(input_name, "-") != 0)
721 setup_browser(true);
722 else {
723 use_browser = 0;
724 perf_hpp__column_enable(PERF_HPP__OVERHEAD);
725 perf_hpp__init();
726 }
727
728repeat:
711 session = perf_session__new(input_name, O_RDONLY, 729 session = perf_session__new(input_name, O_RDONLY,
712 report.force, false, &report.tool); 730 report.force, false, &report.tool);
713 if (session == NULL) 731 if (session == NULL)
@@ -733,14 +751,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
733 751
734 } 752 }
735 753
736 if (strcmp(input_name, "-") != 0)
737 setup_browser(true);
738 else {
739 use_browser = 0;
740 perf_hpp__column_enable(PERF_HPP__OVERHEAD);
741 perf_hpp__init();
742 }
743
744 setup_sorting(report_usage, options); 754 setup_sorting(report_usage, options);
745 755
746 /* 756 /*
@@ -809,6 +819,12 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
809 } 819 }
810 820
811 ret = __cmd_report(&report); 821 ret = __cmd_report(&report);
822 if (ret == K_SWITCH_INPUT_DATA) {
823 perf_session__delete(session);
824 goto repeat;
825 } else
826 ret = 0;
827
812error: 828error:
813 perf_session__delete(session); 829 perf_session__delete(session);
814 return ret; 830 return ret;