aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYordan Karadzhov <ykaradzhov@vmware.com>2019-02-21 14:42:04 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-02-22 14:35:05 -0500
commite9fc4f3265eead58e1935cc370e1708d43fb1b65 (patch)
treebac85ed5068be3860be953d0b91165dd46bc173c
parentfb23b1c236479a15e5534bf0120396118b5ddb6e (diff)
downloadtrace-cmd-e9fc4f3265eead58e1935cc370e1708d43fb1b65.tar.gz
kernel-shark: Fix a bug in shift_XXX methods of the visualization model
In ksmodel_shift_forward() and ksmodel_shift_backward() we are supposed to recalculate only the content of the new (non-overlapping) Bins. However the loop does not take into account that the static function used to do the job actually calculates next Bin (bin + 1). The result is this misunderstanding is that we recalculate also the first overlapping Bin (n). This wipes up the effect of the bug fixed by the previous patch. Link: http://lore.kernel.org/linux-trace-devel/20190221124205.21115-3-ykaradzhov@vmware.com Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..") 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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index a185d6ba..b6d3612b 100644
--- a/kernel-shark/src/libkshark-model.c
+++ b/kernel-shark/src/libkshark-model.c
@@ -505,7 +505,11 @@ void ksmodel_shift_forward(struct kshark_trace_histo *histo, size_t n)
* bin.
*/
bin = histo->n_bins - n - 1;
- for (; bin < histo->n_bins; ++bin) {
+ for (; bin < histo->n_bins - 1; ++bin) {
+ /*
+ * Note that this function will set the bin having index
+ * "bin + 1".
+ */
ksmodel_set_next_bin_edge(histo, bin, last_row);
if (histo->map[bin + 1] > 0)
last_row = histo->map[bin + 1];
@@ -570,7 +574,11 @@ void ksmodel_shift_backward(struct kshark_trace_histo *histo, size_t n)
ksmodel_set_lower_edge(histo);
/* Calculate only the content of the new (non-overlapping) bins. */
- for (bin = 0; bin < n; ++bin) {
+ for (bin = 0; bin < n - 1; ++bin) {
+ /*
+ * Note that this function will set the bin having index
+ * "bin + 1".
+ */
ksmodel_set_next_bin_edge(histo, bin, last_row);
if (histo->map[bin + 1] > 0)
last_row = histo->map[bin + 1];