aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYordan Karadzhov <ykaradzhov@vmware.com>2019-02-13 18:12:10 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-02-13 14:53:35 -0500
commite54616484e3403c005f92d3ddfaaa3e7829ddfa8 (patch)
tree475d2238bb63ccc91267bd045ab52cc02fb6aa11
parentd760045c609097a2cc94eab62837172cdf1c0318 (diff)
downloadtrace-cmd-e54616484e3403c005f92d3ddfaaa3e7829ddfa8.tar.gz
kernel-shark: Do not copy the Upper Overflow bin when shifting forward
ksmodel_shift_forward() copies the mapping indexes of all overlapping bins of the model starting from bin "0" of the new histo up to bin "histo->n_bins - n". Then the mapping index of the old Upper Overflow bin is considered to be the mapping index of first non-overlapping bin, which is wrong. It is wrong because in ksmodel_set_upper_edge() the value of "histo->max" is considered inside the range of the model hence the Upper Overflow bin starts at "histo->max + 1" but the first non-overlapping bin will start at exactly "histo->max". Link: http://lore.kernel.org/linux-trace-devel/20190213161216.14438-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.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index a4041c37..b71a9b85 100644
--- a/kernel-shark/src/libkshark-model.c
+++ b/kernel-shark/src/libkshark-model.c
@@ -500,13 +500,11 @@ void ksmodel_shift_forward(struct kshark_trace_histo *histo, size_t n)
sizeof(histo->map[0]) * (histo->n_bins - n));
/*
- * The mapping index of the old Upper Overflow bin is now index of the
- * first new bin.
+ * Calculate only the content of the new (non-overlapping) bins.
+ * Start from the last copied bin and set the edge of each consecutive
+ * bin.
*/
- bin = UOB(histo) - n;
- histo->map[bin] = histo->map[UOB(histo)];
-
- /* Calculate only the content of the new (non-overlapping) bins. */
+ bin = histo->n_bins - n - 1;
for (; bin < histo->n_bins; ++bin) {
ksmodel_set_next_bin_edge(histo, bin, last_row);
if (histo->map[bin + 1] > 0)