linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: [PATCH v2 6/8] kernel-shark-qt: Add tot_count field to the model descriptor
Date: Fri, 9 Nov 2018 19:50:29 +0000	[thread overview]
Message-ID: <20181109195004.25455-7-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181109195004.25455-1-ykaradzhov@vmware.com>

The tot_count field of the Visualization model descriptor provides
fast access to the total number of entries being currently visualized.
The total count can be useful in various cases. For example the sched
event plugin can use it for knowing when to plot wakeup latency.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/libkshark-model.c | 7 +++++++
 kernel-shark-qt/src/libkshark-model.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/kernel-shark-qt/src/libkshark-model.c b/kernel-shark-qt/src/libkshark-model.c
index ef6ad48..461f88e 100644
--- a/kernel-shark-qt/src/libkshark-model.c
+++ b/kernel-shark-qt/src/libkshark-model.c
@@ -298,6 +298,7 @@ static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo)
 {
 	int i = 0, prev_not_empty;
 
+	histo->tot_count = 0;
 	memset(&histo->bin_count[0], 0,
 	       (histo->n_bins) * sizeof(histo->bin_count[0]));
 	/*
@@ -329,6 +330,10 @@ static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo)
 			histo->bin_count[prev_not_empty] =
 				histo->map[i] - histo->map[prev_not_empty];
 
+			if (prev_not_empty != LOB(histo))
+				histo->tot_count +=
+					histo->bin_count[prev_not_empty];
+
 			prev_not_empty = i;
 		}
 	}
@@ -350,6 +355,8 @@ static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo)
 		histo->bin_count[prev_not_empty] = histo->map[UOB(histo)] -
 						   histo->map[prev_not_empty];
 	}
+
+	histo->tot_count += histo->bin_count[prev_not_empty];
 }
 
 /**
diff --git a/kernel-shark-qt/src/libkshark-model.h b/kernel-shark-qt/src/libkshark-model.h
index db681cc..95c30b6 100644
--- a/kernel-shark-qt/src/libkshark-model.h
+++ b/kernel-shark-qt/src/libkshark-model.h
@@ -51,6 +51,9 @@ struct kshark_trace_histo {
 	/** Number of entries in each bin. */
 	size_t			*bin_count;
 
+	/** Total number of entries in all bin except the overflow bins. */
+	int			tot_count;
+
 	/**
 	 * Lower edge of the time-window to be visualized. Only entries having
 	 * timestamp >= min will be visualized.
-- 
2.17.1

  parent reply	other threads:[~2018-11-10  5:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 19:50 [PATCH v2 0/8] New/improved KernelShark plugins Yordan Karadzhov
2018-11-09 19:50 ` [PATCH v2 1/8] kernel-shark-qt: Reset the second pass hash when reloading Sched plugin Yordan Karadzhov
2018-11-09 19:50 ` [PATCH v2 2/8] kernel-shark-qt: Improve the plotting logic of the Sched event plugin Yordan Karadzhov
2018-11-09 19:50 ` [PATCH v2 3/8] kernel-shark-qt: Update the visualization model when updating Graphs Yordan Karadzhov
2018-11-09 19:50 ` [PATCH v2 4/8] kernel-shark-qt: Add "Missed events" custom kshark_entry Yordan Karadzhov
2018-11-09 19:50 ` [PATCH v2 5/8] kernel-shark-qt: Add instrumentation for "Missed events" to the model Yordan Karadzhov
2018-11-09 19:50 ` Yordan Karadzhov [this message]
2018-11-09 19:50 ` [PATCH v2 7/8] kernel-shark-qt: Add "Missed events" plugin for KernelShark Yordan Karadzhov
2018-11-09 19:50 ` [PATCH v2 8/8] kernel-shark-qt: Update Sched Events plugin Yordan Karadzhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109195004.25455-7-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).