linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] perf session: Add perf_session__delete_env
@ 2012-11-20  9:31 Feng Tang
  2012-11-20  9:31 ` [PATCH 2/3] perf hists browser: Add option for runtime switching perf data file Feng Tang
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Feng Tang @ 2012-11-20  9:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Namhyung Kim, Andi Kleen, linux-kernel
  Cc: Namhyung Kim

From: Namhyung Kim <namhyung.kim@lge.com>

The perf session environment information was saved (so allocated)
during perf_session__open, but was not freed.  As free(3) handles NULL
pointer input properly it won't cause a issue for writing modes -
e.g. perf record.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/session.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index ce6f511..e9ce524 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -204,11 +204,30 @@ static void perf_session__delete_threads(struct perf_session *session)
 	machine__delete_threads(&session->host_machine);
 }
 
+static void perf_session__delete_env(struct perf_session *self)
+{
+	struct perf_session_env *env = &self->header.env;
+
+	free(env->hostname);
+	free(env->os_release);
+	free(env->version);
+	free(env->arch);
+	free(env->cpu_desc);
+	free(env->cpuid);
+
+	free(env->cmdline);
+	free(env->sibling_cores);
+	free(env->sibling_threads);
+	free(env->numa_nodes);
+	free(env->pmu_mappings);
+}
+
 void perf_session__delete(struct perf_session *self)
 {
 	perf_session__destroy_kernel_maps(self);
 	perf_session__delete_dead_threads(self);
 	perf_session__delete_threads(self);
+	perf_session__delete_env(self);
 	machine__exit(&self->host_machine);
 	close(self->fd);
 	free(self);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH 1/3] perf browser: Don't show scripts menu for 'perf top'
@ 2012-10-31 16:00 Feng Tang
  2012-10-31 16:00 ` [PATCH 3/3] perf report: Enable the runtime switching of perf data file Feng Tang
  0 siblings, 1 reply; 12+ messages in thread
From: Feng Tang @ 2012-10-31 16:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Namhyung Kim, Andi Kleen, linux-kernel
  Cc: Feng Tang

As 'perf top' has no data files to run scripts against. Also add
a is_report_browser() helper function to judge whether the running
browser is for 'perf report'.

Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 tools/perf/ui/browsers/hists.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fe62284..082078a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1127,6 +1127,12 @@ static inline void free_popup_options(char **options, int n)
 	}
 }
 
+/* Check whether the browser is for 'top' or 'report' */
+static inline bool is_report_browser(void *timer)
+{
+	return timer == NULL;
+}
+
 static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 				    const char *helpline, const char *ev_name,
 				    bool left_exits,
@@ -1214,7 +1220,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 			}
 			continue;
 		case 'r':
-			goto do_scripts;
+			if (is_report_browser(timer))
+				goto do_scripts;
+			continue;
 		case K_F1:
 		case 'h':
 		case '?':
@@ -1233,7 +1241,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 					"E             Expand all callchains\n"
 					"d             Zoom into current DSO\n"
 					"t             Zoom into current Thread\n"
-					"r             Run available scripts\n"
+					"r             Run available scripts('perf report' only)\n"
 					"P             Print histograms to perf.hist.N\n"
 					"V             Verbose (DSO names in callchains, etc)\n"
 					"/             Filter symbol by name");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-01-24 18:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-20  9:31 [PATCH 1/3] perf session: Add perf_session__delete_env Feng Tang
2012-11-20  9:31 ` [PATCH 2/3] perf hists browser: Add option for runtime switching perf data file Feng Tang
2012-11-20 15:16   ` Arnaldo Carvalho de Melo
2012-11-20 16:16     ` Feng Tang
2012-11-20 16:24     ` Feng Tang
2012-11-20  9:31 ` [PATCH 3/3] perf report: Enable the runtime switching of " Feng Tang
2012-11-20 15:13 ` [PATCH 1/3] perf session: Add perf_session__delete_env Arnaldo Carvalho de Melo
2012-11-20 15:20   ` Namhyung Kim
2012-11-21  4:43     ` [PATCH v2 1/3] perf session: Free environment information when deleting session Namhyung Kim
2013-01-24 18:39       ` [tip:perf/core] " tip-bot for Namhyung Kim
  -- strict thread matches above, loose matches on Subject: below --
2012-10-31 16:00 [PATCH 1/3] perf browser: Don't show scripts menu for 'perf top' Feng Tang
2012-10-31 16:00 ` [PATCH 3/3] perf report: Enable the runtime switching of perf data file Feng Tang
2012-11-02  2:48   ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).