aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYordan Karadzhov <ykaradzhov@vmware.com>2019-03-07 17:43:14 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-03-13 09:52:11 -0400
commitbedcff11657d832175c4fc27efc9fff525f96c14 (patch)
tree1f4ce2c2636764d162096f8f1757789baf4dfa72
parent2288cb9a11616ca75abcde498ddaf107da2f2b18 (diff)
downloadtrace-cmd-bedcff11657d832175c4fc27efc9fff525f96c14.tar.gz
kernel-shark: Fix a bug in ksmodel_zoom
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. Link: http://lore.kernel.org/linux-trace-devel/20190307154316.19194-3-ykaradzhov@vmware.com Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model used by the Qt-based KS") Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--kernel-shark/src/libkshark-model.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index 4bd1e2c4..af3440be 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