From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 3/3] kernel-shark: Search for visible entry only if this is really needed
Date: Mon, 16 Dec 2019 15:39:17 +0200 [thread overview]
Message-ID: <20191216133917.31690-3-y.karadz@gmail.com> (raw)
In-Reply-To: <20191216133917.31690-1-y.karadz@gmail.com>
ksmodel_task_visible_event_exist() and ksmodel_cpu_visible_event_exist()
are relatively expensive operations. It make sense to perform those only
if the entry that was found so far has been filtered out (is invisible).
The patch also makes the processing of the CPU and Task graphs more
consistent.
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
kernel-shark/src/KsPlotTools.cpp | 42 ++++++++++++++++++++------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp
index a8eddcd..fe3008e 100644
--- a/kernel-shark/src/KsPlotTools.cpp
+++ b/kernel-shark/src/KsPlotTools.cpp
@@ -829,14 +829,17 @@ void Graph::fillCPUGraph(int cpu)
pidBack = KS_FILTERED_BIN;
visMask = 0x0;
- if (ksmodel_cpu_visible_event_exist(_histoPtr, bin,
- cpu,
- _collectionPtr,
- &index))
-
- visMask = _histoPtr->data[index]->visible;
- else if (eFront)
- visMask = eFront->visible;
+ if (eFront) {
+ if (!(eFront->visible & KS_EVENT_VIEW_FILTER_MASK) &&
+ ksmodel_cpu_visible_event_exist(_histoPtr, bin,
+ cpu,
+ _collectionPtr,
+ &index)) {
+ visMask = _histoPtr->data[index]->visible;
+ } else {
+ visMask = eFront->visible;
+ }
+ }
};
auto lamSetBin = [&] (int bin)
@@ -918,6 +921,7 @@ void Graph::fillCPUGraph(int cpu)
void Graph::fillTaskGraph(int pid)
{
int cpuFront, cpuBack(0), pidFront(0), pidBack(0), lastCpu(-1), bin(0);
+ struct kshark_entry *eFront;
uint8_t visMask;
ssize_t index;
@@ -991,12 +995,15 @@ void Graph::fillTaskGraph(int pid)
auto lamGetPidCPU = [&] (int bin)
{
+ eFront = nullptr;
/* Get the CPU used by this task. */
cpuFront = ksmodel_get_cpu_front(_histoPtr, bin,
pid,
false,
_collectionPtr,
- nullptr);
+ &index);
+ if (index >= 0)
+ eFront = _histoPtr->data[index];
cpuBack = ksmodel_get_cpu_back(_histoPtr, bin,
pid,
@@ -1026,12 +1033,17 @@ void Graph::fillTaskGraph(int pid)
nullptr);
visMask = 0x0;
- if (ksmodel_task_visible_event_exist(_histoPtr,
- bin,
- pid,
- _collectionPtr,
- &index)) {
- visMask = _histoPtr->data[index]->visible;
+ if (eFront) {
+ if (!(eFront->visible & KS_EVENT_VIEW_FILTER_MASK) &&
+ ksmodel_task_visible_event_exist(_histoPtr,
+ bin,
+ pid,
+ _collectionPtr,
+ &index)) {
+ visMask = _histoPtr->data[index]->visible;
+ } else {
+ visMask = eFront->visible;
+ }
}
}
};
--
2.20.1
prev parent reply other threads:[~2019-12-16 13:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-16 13:39 [PATCH 1/3] kernel-shark: Simplify the way collections handle data requests Yordan Karadzhov (VMware)
2019-12-16 13:39 ` [PATCH 2/3] kernel-shark: Avoid redrawing the graphs when switching the keyboard focus Yordan Karadzhov (VMware)
2019-12-16 13:39 ` Yordan Karadzhov (VMware) [this message]
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=20191216133917.31690-3-y.karadz@gmail.com \
--to=y.karadz@gmail.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).