linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: bug fixes and cleanups for perf sched
@ 2011-06-07 14:45 Stephane Eranian
  0 siblings, 0 replies; only message in thread
From: Stephane Eranian @ 2011-06-07 14:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz, acme


perf sched latency was printing garbage because it was using
stale pointers from a deleted session structure. This patches
fixes the problem.

The patch also cleans up the data structure definitions for all
the arrays used to store the processor name (comm).

Finally, the patch updates the man page and help text to reflect
the actual options of the command. perf sched trace does not
exist anymore, AFAICT. Without this change, users get an error
when invoking perf sched trace but they have no idea why.

Signed-off-by: Stephane Eranian <eranian@google.com>
---

diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
index 46822d5..ad764cc 100644
--- a/tools/perf/Documentation/perf-sched.txt
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -8,7 +8,7 @@ perf-sched - Tool to trace/measure scheduler properties (latencies)
 SYNOPSIS
 --------
 [verse]
-'perf sched' {record|latency|map|replay|trace}
+'perf sched' {record|latency|map|replay|script}
 
 DESCRIPTION
 -----------
@@ -20,7 +20,7 @@ There are five variants of perf sched:
   'perf sched latency' to report the per task scheduling latencies
   and other scheduling properties of the workload.
 
-  'perf sched trace' to see a detailed trace of the workload that
+  'perf sched script' to see a detailed trace of the workload that
   was recorded.
 
   'perf sched replay' to simulate the workload that was recorded
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index dcfe887..d5a9d9e 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -649,11 +649,11 @@ struct trace_switch_event {
 	u32 common_pid;
 	u32 common_tgid;
 
-	char prev_comm[16];
+	char prev_comm[COMM_LEN];
 	u32 prev_pid;
 	u32 prev_prio;
 	u64 prev_state;
-	char next_comm[16];
+	char next_comm[COMM_LEN];
 	u32 next_pid;
 	u32 next_prio;
 };
@@ -667,7 +667,7 @@ struct trace_runtime_event {
 	u32 common_pid;
 	u32 common_tgid;
 
-	char comm[16];
+	char comm[COMM_LEN];
 	u32 pid;
 	u64 runtime;
 	u64 vruntime;
@@ -682,7 +682,7 @@ struct trace_wakeup_event {
 	u32 common_pid;
 	u32 common_tgid;
 
-	char comm[16];
+	char comm[COMM_LEN];
 	u32 pid;
 
 	u32 prio;
@@ -699,9 +699,9 @@ struct trace_fork_event {
 	u32 common_pid;
 	u32 common_tgid;
 
-	char parent_comm[16];
+	char parent_comm[COMM_LEN];
 	u32 parent_pid;
-	char child_comm[16];
+	char child_comm[COMM_LEN];
 	u32 child_pid;
 };
 
@@ -714,7 +714,7 @@ struct trace_migrate_task_event {
 	u32 common_pid;
 	u32 common_tgid;
 
-	char comm[16];
+	char comm[COMM_LEN];
 	u32 pid;
 
 	u32 prio;
@@ -1651,8 +1651,12 @@ static int read_events(void)
 		nr_lost_events = session->hists.stats.total_lost;
 		nr_lost_chunks = session->hists.stats.nr_events[PERF_RECORD_LOST];
 	}
-
-	perf_session__delete(session);
+	/*
+	 * cannot delete session because cmd_lat() is relying on work_atoms
+	 * which point to fields (e.g., thread) which are part of the session.
+	 *
+	 * perf_session__delete(session);
+	 */
 	return err;
 }
 
@@ -1769,7 +1773,7 @@ static void __cmd_replay(void)
 
 
 static const char * const sched_usage[] = {
-	"perf sched [<options>] {record|latency|map|replay|trace}",
+	"perf sched [<options>] {record|latency|map|replay|script}",
 	NULL
 };
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-07 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 14:45 [PATCH] perf: bug fixes and cleanups for perf sched Stephane Eranian

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