From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> Subject: [PATCH v2 1/7] kernel-shark: Preserve markers when appending data Date: Mon, 17 May 2021 17:21:34 +0300 [thread overview] Message-ID: <20210517142140.286153-2-y.karadz@gmail.com> (raw) In-Reply-To: <20210517142140.286153-1-y.karadz@gmail.com> When an entry is selected in the KernelShark GUI (using marker A and marker B) we only keep track the index of this entry inside the array of entries loaded at the moment of selecting. However, then a data file is appended, the new entries are merged to this array and the array is sorted. As a result the index of the marker can/will point to completely different entry. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- src/KsDualMarker.hpp | 6 ++++++ src/KsMainWindow.cpp | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/KsDualMarker.hpp b/src/KsDualMarker.hpp index 0dcaf93..39c0ce2 100644 --- a/src/KsDualMarker.hpp +++ b/src/KsDualMarker.hpp @@ -154,6 +154,12 @@ public: void updateLabels(); + /** Get the index inside the data array marker A points to. */ + ssize_t markerAPos() {return markerA()._isSet ? markerA()._pos : -1;} + + /** Get the index inside the data array marker B points to. */ + ssize_t markerBPos() {return markerB()._isSet ? markerB()._pos : -1;} + signals: /** * This signal is emitted when the Table View has to switch the color diff --git a/src/KsMainWindow.cpp b/src/KsMainWindow.cpp index d0a434a..fa893ce 100644 --- a/src/KsMainWindow.cpp +++ b/src/KsMainWindow.cpp @@ -571,8 +571,15 @@ void KsMainWindow::markEntry(ssize_t row, DualMarkerState st) /** Select given kshark_entry with a given maker. */ void KsMainWindow::markEntry(const kshark_entry *e, DualMarkerState st) { - ssize_t row = kshark_find_entry_by_time(e->ts, _data.rows(), - 0, _data.size() - 1); + ssize_t row; + + if (!e) { + _mState.getMarker(st).reset(); + return; + } + + row = kshark_find_entry_by_time(e->ts, _data.rows(), + 0, _data.size() - 1); markEntry(row, st); } @@ -1341,7 +1348,20 @@ void KsMainWindow::loadDataFile(const QString& fileName) /** Append trace data for file. */ void KsMainWindow::appendDataFile(const QString& fileName) { + kshark_entry *eMarkA(nullptr), *eMarkB(nullptr); + int rowA = _mState.markerAPos(); + int rowB = _mState.markerBPos(); + + if (rowA >= 0) + eMarkA = _data.rows()[rowA]; + + if (rowB >= 0) + eMarkB = _data.rows()[rowB]; + _load(fileName, true); + + markEntry(eMarkA, DualMarkerState::A); + markEntry(eMarkB, DualMarkerState::B); } void KsMainWindow::_error(const QString &mesg, -- 2.27.0
next prev parent reply other threads:[~2021-05-17 14:59 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-17 14:21 [PATCH v2 0/7] Final fixes before KS 2.0 Yordan Karadzhov (VMware) 2021-05-17 14:21 ` Yordan Karadzhov (VMware) [this message] 2021-05-17 14:21 ` [PATCH v2 2/7] kernel-shark: Preserve open graphs when appending data Yordan Karadzhov (VMware) 2021-05-17 14:21 ` [PATCH v2 3/7] kernel-shark: Clear before loading new session Yordan Karadzhov (VMware) 2021-05-17 14:21 ` [PATCH v2 4/7] kernel-shark: Better handling of plugins when appending data file Yordan Karadzhov (VMware) 2021-05-17 14:21 ` [PATCH v2 5/7] kernel-shark: Do draw the combo point of the mark Yordan Karadzhov (VMware) 2021-05-17 14:21 ` [PATCH v2 6/7] kernel-shark: Fix the checking if "trace_seq" was destroyed Yordan Karadzhov (VMware) 2021-05-17 14:21 ` [PATCH v2 7/7] kernel-shark: No slash at the end of KS_PLUGIN_INSTALL_PREFIX Yordan Karadzhov (VMware) 2021-05-17 23:21 ` [PATCH v2 0/7] Final fixes before KS 2.0 Steven Rostedt 2021-05-17 23:28 ` Steven Rostedt 2021-05-18 7:30 ` Yordan Karadzhov 2021-05-18 12:46 ` Steven Rostedt 2021-05-18 12:58 ` Yordan Karadzhov 2021-05-18 13:44 ` Steven Rostedt
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=20210517142140.286153-2-y.karadz@gmail.com \ --to=y.karadz@gmail.com \ --cc=linux-trace-devel@vger.kernel.org \ --subject='Re: [PATCH v2 1/7] kernel-shark: Preserve markers when appending data' \ /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
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).