diff mbox series

[1/3] kernel-shark: Fix a bug in ksmodel_shift_backward()

Message ID 20190221124205.21115-2-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit fb23b1c236479a15e5534bf0120396118b5ddb6e
Headers show
Series KernelShark visualization model fixes | expand

Commit Message

Yordan Karadzhov Feb. 21, 2019, 12:42 p.m. UTC
Bin 0 of the new model has to be set after copying the overlaping bins
from the old model. Otherwise the new content of Bin 0 will be copied
into Bin "n". This bug has no effect because ksmodel_shift_backward()
has a second bug in the loop over the non-overlapping bins. The second
bug will be fixed in the following patch.

Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..")
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/src/libkshark-model.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index b71a9b8..a185d6b 100644
--- a/kernel-shark/src/libkshark-model.c
+++ b/kernel-shark/src/libkshark-model.c
@@ -557,17 +557,18 @@  void ksmodel_shift_backward(struct kshark_trace_histo *histo, size_t n)
 		ksmodel_fill(histo, histo->data, histo->data_size);
 		return;
 	}
-	/* Set the new Lower Overflow bin. */
-	ksmodel_set_lower_edge(histo);
 
 	/*
-	 * Copy the the mapping indexes of all overlaping bins starting from
+	 * Copy the mapping indexes of all overlaping bins starting from
 	 * bin "0" of the old histo. Note that the number of overlaping bins
 	 * is histo->n_bins - n.
 	 */
 	memmove(&histo->map[n], &histo->map[0],
 		sizeof(histo->map[0]) * (histo->n_bins - n));
 
+	/* Set the new Lower Overflow bin. */
+	ksmodel_set_lower_edge(histo);
+
 	/* Calculate only the content of the new (non-overlapping) bins. */
 	for (bin = 0; bin < n; ++bin) {
 		ksmodel_set_next_bin_edge(histo, bin, last_row);