diff mbox series

kernel-shark-qt: Handle the case when the range of the model is too small

Message ID 20190115101857.25857-1-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit 94efea9606c76d94d6a4ef3d159675ed0ec8ea15
Headers show
Series kernel-shark-qt: Handle the case when the range of the model is too small | expand

Commit Message

Yordan Karadzhov Jan. 15, 2019, 10:18 a.m. UTC
The size of the bin must be equal or greater than 1, hence the range
must be equal or greater than the number of bins. When this condition
is not satisfied, the range has to be extended, instead of just leaving
the model unset.

Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/libkshark-model.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Steven Rostedt Jan. 15, 2019, 3:05 p.m. UTC | #1
On Tue, 15 Jan 2019 12:18:57 +0200
Yordan Karadzhov <ykaradzhov@vmware.com> wrote:

> The size of the bin must be equal or greater than 1, hence the range
> must be equal or greater than the number of bins. When this condition
> is not satisfied, the range has to be extended, instead of just leaving
> the model unset.
> 
> Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

You forgot to add:

Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model used by the Qt-based KS")

;-)

-- Steve

> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
> ---
>  kernel-shark-qt/src/libkshark-model.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel-shark-qt/src/libkshark-model.c b/kernel-shark-qt/src/libkshark-model.c
> index 76e2940..2094795 100644
> --- a/kernel-shark-qt/src/libkshark-model.c
> +++ b/kernel-shark-qt/src/libkshark-model.c
> @@ -102,8 +102,10 @@ static void ksmodel_set_in_range_bining(struct kshark_trace_histo *histo,
>  	struct kshark_entry *last;
>  
>  	/* The size of the bin must be >= 1, hence the range must be >= n. */
> -	if (n == 0 || range < n)
> -		return;
> +	if (n == 0 || range < n) {
> +		range = n;
> +		max = min + n;
> +	}
>  
>  	/*
>  	 * If the number of bins changes, allocate memory for the descriptor of
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/libkshark-model.c b/kernel-shark-qt/src/libkshark-model.c
index 76e2940..2094795 100644
--- a/kernel-shark-qt/src/libkshark-model.c
+++ b/kernel-shark-qt/src/libkshark-model.c
@@ -102,8 +102,10 @@  static void ksmodel_set_in_range_bining(struct kshark_trace_histo *histo,
 	struct kshark_entry *last;
 
 	/* The size of the bin must be >= 1, hence the range must be >= n. */
-	if (n == 0 || range < n)
-		return;
+	if (n == 0 || range < n) {
+		range = n;
+		max = min + n;
+	}
 
 	/*
 	 * If the number of bins changes, allocate memory for the descriptor of