Skip to contentSkip to conversation

kernelshark: Fix bug with Plot CPU filtering

PATCH New David Sharp 1 participant 4 messages Nov 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 kernelshark: Fix bug with Plot CPU filtering

From: Venkatesh Pallipadi <[email protected]>

Plot CPU filtering in kernelshark has the following bug:
1) Deselect CPU A from Plot CPU list
2) Plot gets updated with no CPU A
3) Deselect CPU B
4) Plot continues to have CPU B

This is due to a bug in graph_plot_cpus_update_callback(), which seems to be checking old_all_cpus != new_all_cpus before doing any update. This condition is true on 1, but false on 2. Removing that check fixes the problem.

Tested:
Above sequence now does expected filtering.

Google-bug-id: 4258610

---
 trace-plot-cpu.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
trace-plot-cpu.c +2 -3
index 630d6c2..bb767d3 100644
@@ -498,9 +498,8 @@ void graph_plot_cpus_update_callback(gboolean accept,
 	/* Get the current status */
 	graph_plot_cpus_plotted(ginfo, &old_all_cpus, &old_cpu_mask);
 
-	if (old_all_cpus == all_cpus ||
-	    (selected_cpu_mask &&
-	     cpus_equal(old_cpu_mask, selected_cpu_mask, ginfo->cpus))) {
+	if (selected_cpu_mask &&
+	     cpus_equal(old_cpu_mask, selected_cpu_mask, ginfo->cpus)) {
 		/* Nothing to do */
 		g_free(old_cpu_mask);
 		return;
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 2/4 kernel-shark: Allow unsetting of all CPUs in filter

From: Vaibhav Nagarnaik <[email protected]>

The button "All CPUs" in CPU filter dialog allows setting of all CPUs but doesn't clear CPUs when it is unchecked. Make sure that when the "All CPUs" button is unchecked, all the CPUs get unchecked.

Tested: In kernelshark, go to Filter->list CPUs and uncheck "All CPUs" button. All the CPUs should be unchecked at that point.

---
 trace-filter.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
trace-filter.c +4 -6
index c657a18..89cf032 100644
@@ -1723,12 +1723,10 @@ void cpu_toggle(gpointer data, GtkWidget *widget)
 
 	if (strcmp(label, CPU_ALL_CPUS_STR) == 0) {
 		cpu_helper->allcpus = active;
-		if (active) {
-			/* enable all toggles */
-			for (cpu = 0; cpu < cpu_helper->cpus; cpu++)
-				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cpu_helper->buttons[cpu]),
-							     TRUE);
-		}
+		/* enable/disable all toggles */
+		for (cpu = 0; cpu < cpu_helper->cpus; cpu++)
+			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cpu_helper->buttons[cpu]),
+						     active ? TRUE : FALSE);
 		return;
 	}
 
Signature · 1 line
1.7.7.3
#2 lore raw

PATCH 3/4 kernel-shark: Don't check for system name for sched events

In reply to David Sharp

From: Vaibhav Nagarnaik <[email protected]>

The sched tracepoint names are unique and so there is no need to check for the subsystem name while looking up the event ID.

This helps kernel shark display the graphs correctly for trace.dat files generated from trace collection mechanisms that don't record the subsystem.

Google-Bug-Id: 6333917

---
 trace-graph.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
trace-graph.c +3 -3
index 4d81219..6f72350 100644
@@ -1016,7 +1016,7 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo,
 		found = FALSE;
 
 		event = pevent_find_event_by_name(ginfo->pevent,
-						  "sched", "sched_wakeup");
+						  NULL, "sched_wakeup");
 		if (event) {
 			found = TRUE;
 			ginfo->event_wakeup_id = event->id;
@@ -1026,7 +1026,7 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo,
 
 
 		event = pevent_find_event_by_name(ginfo->pevent,
-						  "sched", "sched_wakeup_new");
+						  NULL, "sched_wakeup_new");
 		if (event) {
 			found = TRUE;
 			ginfo->event_wakeup_new_id = event->id;
@@ -1086,7 +1086,7 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo,
 
 	if (ginfo->event_sched_switch_id < 0) {
 		event = pevent_find_event_by_name(ginfo->pevent,
-						  "sched", "sched_switch");
+						  NULL, "sched_switch");
 		if (!event)
 			return 0;
 
Signature · 1 line
1.7.7.3
#3 lore raw

PATCH 4/4 kernelshark: Full-height cursor and mark lines

In reply to David Sharp

"width" and "height" were swapped, causing the vertical marker and cursor lines to be drawn with the wrong height.

---
 trace-graph.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
trace-graph.c +4 -4
index 6f72350..60e5241 100644
@@ -380,7 +380,7 @@ static void draw_cursor(struct graph_info *ginfo)
 	x = convert_time_to_x(ginfo, ginfo->cursor);
 
 	gdk_draw_line(ginfo->draw->window, ginfo->draw->style->mid_gc[3],
-		      x, 0, x, ginfo->draw->allocation.width);
+		      x, 0, x, ginfo->draw->allocation.height);
 }
 
 static void draw_marka(struct graph_info *ginfo)
@@ -392,7 +392,7 @@ static void draw_marka(struct graph_info *ginfo)
 
 	x = convert_time_to_x(ginfo, ginfo->marka_time);
 	gdk_draw_line(ginfo->draw->window, green,
-		      x, 0, x, ginfo->draw->allocation.width);
+		      x, 0, x, ginfo->draw->allocation.height);
 }
 
 static void draw_markb(struct graph_info *ginfo)
@@ -404,7 +404,7 @@ static void draw_markb(struct graph_info *ginfo)
 
 	x = convert_time_to_x(ginfo, ginfo->markb_time);
 	gdk_draw_line(ginfo->draw->window, red,
-		      x, 0, x, ginfo->draw->allocation.width);
+		      x, 0, x, ginfo->draw->allocation.height);
 }
 
 static void update_with_backend(struct graph_info *ginfo,
@@ -434,7 +434,7 @@ static void
 draw_line(GtkWidget *widget, gdouble x, struct graph_info *ginfo)
 {
 	gdk_draw_line(widget->window, widget->style->black_gc,
-		      x, 0, x, widget->allocation.width);
+		      x, 0, x, widget->allocation.height);
 }
 
 static void clear_line(struct graph_info *ginfo, gint x)
Signature · 1 line
1.7.7.3