2012-11-15 01:51:18

by David Sharp

[permalink] [raw]
Subject: [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
Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: David Sharp <[email protected]>
---
trace-plot-cpu.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c
index 630d6c2..bb767d3 100644
--- a/trace-plot-cpu.c
+++ b/trace-plot-cpu.c
@@ -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;
--
1.7.7.3


2012-11-15 01:51:23

by David Sharp

[permalink] [raw]
Subject: [PATCH 4/4] kernelshark: Full-height cursor and mark lines

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

Signed-off-by: David Sharp <[email protected]>
---
trace-graph.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/trace-graph.c b/trace-graph.c
index 6f72350..60e5241 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -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)
--
1.7.7.3

2012-11-15 01:51:21

by David Sharp

[permalink] [raw]
Subject: [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.

Signed-off-by: Vaibhav Nagarnaik <[email protected]>
Signed-off-by: David Sharp <[email protected]>
---
trace-filter.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/trace-filter.c b/trace-filter.c
index c657a18..89cf032 100644
--- a/trace-filter.c
+++ b/trace-filter.c
@@ -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;
}

--
1.7.7.3

2012-11-15 01:51:20

by David Sharp

[permalink] [raw]
Subject: [PATCH 3/4] kernel-shark: Don't check for system name for sched events

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
Signed-off-by: Vaibhav Nagarnaik <[email protected]>
Signed-off-by: David Sharp <[email protected]>
---
trace-graph.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/trace-graph.c b/trace-graph.c
index 4d81219..6f72350 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -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;

--
1.7.7.3

2012-11-15 01:52:41

by David Sharp

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernelshark: Fix bug with Plot CPU filtering

sorry for the dups... typoed Steve's domain.

On Wed, Nov 14, 2012 at 5:51 PM, David Sharp <[email protected]> wrote:
> 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
> Signed-off-by: Venkatesh Pallipadi <[email protected]>
> Signed-off-by: David Sharp <[email protected]>

2012-11-15 02:20:41

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 2/4] kernel-shark: Allow unsetting of all CPUs in filter

On Wed, 2012-11-14 at 17:51 -0800, David Sharp wrote:
> 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.

This was actually done purposely, as I thought it may be used as a way
to change to a mode to select individual CPUs.

But I'm fine with having it do this feature, except...

Now when I apply this patch, if I go to deselect a CPU, it unselects the
"All CPUs" and causes all CPUs to be unselected.

Need to make it so it only unselects all CPUs if it was directly
unselected. Not when its done by deselecting a single CPU.

So, I'm going to NAK this patch, but if you can fix it so that
deselecting the "All CPUs" directly has this feature, but I can still
deselect a single CPU without it causing all other CPUs to be
deselected, then I'm fine with the change.

-- Steve

>
> Signed-off-by: Vaibhav Nagarnaik <[email protected]>
> Signed-off-by: David Sharp <[email protected]>
> ---
> trace-filter.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/trace-filter.c b/trace-filter.c
> index c657a18..89cf032 100644
> --- a/trace-filter.c
> +++ b/trace-filter.c
> @@ -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;
> }
>

2012-11-15 02:27:41

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 4/4] kernelshark: Full-height cursor and mark lines

On Wed, 2012-11-14 at 17:51 -0800, David Sharp wrote:
> "width" and "height" were swapped, causing the vertical marker and cursor lines
> to be drawn with the wrong height.

Is this the fix to the strange "mark bottom stays around" bug? It's been
on my TODO list for a long time to fix that. ;-)

-- Steve

>
> Signed-off-by: David Sharp <[email protected]>
> ---
> trace-graph.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/trace-graph.c b/trace-graph.c
> index 6f72350..60e5241 100644
> --- a/trace-graph.c
> +++ b/trace-graph.c
> @@ -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)

2012-11-15 02:32:02

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernelshark: Fix bug with Plot CPU filtering

On Wed, 2012-11-14 at 17:52 -0800, David Sharp wrote:
> sorry for the dups... typoed Steve's domain.
>

I applied and pushed out patches 1,3 and 4. I already commented on why I
neglected patch 2.

-- Steve

2012-11-15 19:55:27

by David Sharp

[permalink] [raw]
Subject: Re: [PATCH 4/4] kernelshark: Full-height cursor and mark lines

On Wed, Nov 14, 2012 at 6:27 PM, Steven Rostedt <[email protected]> wrote:
> On Wed, 2012-11-14 at 17:51 -0800, David Sharp wrote:
>> "width" and "height" were swapped, causing the vertical marker and cursor lines
>> to be drawn with the wrong height.
>
> Is this the fix to the strange "mark bottom stays around" bug? It's been
> on my TODO list for a long time to fix that. ;-)

That's not how I would have described the bug, but maybe it's the
same. What I was seeing was the marks not extending all the way to the
bottom of all the plot area when scrolled down. I assume it would only
manifest that way when the plot is taller than it is wide (eg, tons of
thread plots and fully zoomed out). In the reverse situation, it would
be telling gdk to draw outside the bounds of the widget, which might
do something weird, although I would hope it would just draw what it
could and refuse to draw outside.

>
> -- Steve
>
>>
>> Signed-off-by: David Sharp <[email protected]>
>> ---
>> trace-graph.c | 8 ++++----
>> 1 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/trace-graph.c b/trace-graph.c
>> index 6f72350..60e5241 100644
>> --- a/trace-graph.c
>> +++ b/trace-graph.c
>> @@ -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)
>
>