Message ID | 20190307150511.17246-3-ykaradzhov@vmware.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Various minor modifications and fixes toward KS 1.0 | expand |
diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c index 4bd1e2c..7574cbe 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
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 such 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(-)