All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
	Yordan Karadzhov <ykaradzhov@vmware.com>
Subject: [PATCH v2 2/4] kernel-shark: Fix a bug in ksmodel_zoom
Date: Thu,  7 Mar 2019 17:43:14 +0200	[thread overview]
Message-ID: <20190307154316.19194-3-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20190307154316.19194-1-ykaradzhov@vmware.com>

When zooming-in the model is supposed to avoid over-zooming by
recalculation the Scale factor. The new value of the Scale factor is
supposed to be such that the size of the bin cannot be smaller than 5
ns. This patch fixes a naive bug in the way the new scale value is
calculated. The bug was introduced in

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

but had no effect until

94efea960 ("kernel-shark-qt: Handle the case when the range of the model is too small")

because the ridiculous value of the Scale factor resulted in a very
small model range and because of this the modification of the model
was always rejected.

Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model used by the Qt-based KS")
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/src/libkshark-model.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index 4bd1e2c..af3440b 100644
--- a/kernel-shark/src/libkshark-model.c
+++ b/kernel-shark/src/libkshark-model.c
@@ -648,8 +648,8 @@ static void ksmodel_zoom(struct kshark_trace_histo *histo,
 	 * Avoid overzooming. If needed, adjust the Scale factor to a the value
 	 * which provides bin_size >= 5.
 	 */
-	if (zoom_in && range * (1 - r) < histo->n_bins * 5)
-		r = 1 - (histo->n_bins * 5) / range;
+	if (zoom_in && (int) range * (1. - r) < histo->n_bins * 5)
+		r = 1. - (histo->n_bins * 5.) / range;
 
 	/*
 	 * Now calculate the new range of the histo. Use the bin of the marker
-- 
2.19.1


  parent reply	other threads:[~2019-03-07 15:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 15:43 [PATCH v2 0/4] Various minor modifications and fixes toward KS 1.0 Yordan Karadzhov
2019-03-07 15:43 ` [PATCH v2 1/4] kernel-shark: Specify the OpenGL interface used by KernelShark Yordan Karadzhov
2019-03-07 15:43 ` Yordan Karadzhov [this message]
2019-03-13 13:51   ` [PATCH v2 2/4] kernel-shark: Fix a bug in ksmodel_zoom Steven Rostedt
2019-03-13 13:57     ` Yordan Karadzhov
2019-03-07 15:43 ` [PATCH v2 3/4] kernel-shark: Fix Doxygen warning from sched_events Yordan Karadzhov
2019-03-07 15:43 ` [PATCH v2 4/4] kernel-shark: Fix a bug in KsPluginManager Yordan Karadzhov
2019-03-11 12:09   ` Slavomir Kaslev
2019-03-11 13:20     ` Yordan Karadzhov (VMware)
2019-03-11 13:44       ` Slavomir Kaslev
2019-03-11 17:55         ` Yordan Karadzhov (VMware)
2019-03-11 18:15           ` Steven Rostedt
2019-03-26  1:58             ` Steven Rostedt
2019-03-26 13:37               ` Yordan Karadzhov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190307154316.19194-3-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.