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. Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..") Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> --- kernel-shark/src/libkshark-model.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c index a185d6b..b6d3612 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]; -- 2.17.1