Blob Blame History Raw
From: Thomas Renninger <trenn@suse.de>
Subject: Fix huge and wronge C-state drawings due to uninitialized start/end timestamps
Patch-Mainline: not yet
References: none

Signed-off-by: Thomas Renninger <trenn@suse.de>

---
 tools/perf/builtin-timechart.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6.37-master/tools/perf/builtin-timechart.c
===================================================================
--- linux-2.6.37-master.orig/tools/perf/builtin-timechart.c
+++ linux-2.6.37-master/tools/perf/builtin-timechart.c
@@ -654,8 +654,15 @@ static void draw_c_p_states(void)
 	 * two pass drawing so that the P state bars are on top of the C state blocks
 	 */
 	while (pwr) {
-		if (pwr->type == CSTATE)
+		if (pwr->type == CSTATE) {
+			/* If the first event is an _end event, start timestamp is zero
+			   -> ignore these */
+			if (pwr->start_time == 0 || pwr->end_time == 0) {
+				pwr = pwr->next;
+				continue;
+			}
 			svg_cstate(pwr->cpu, pwr->start_time, pwr->end_time, pwr->state);
+		}
 		pwr = pwr->next;
 	}