Tracing: CtfVisualizer: Apply thread restrictions to statistics, too

The statistics are now also filtered by the selected threads. If no
thread is selected, the statistics are presented for all threads combined.
This fixes a bug with double counted events, too.

Change-Id: I9afa0bf5bc85ccf363e00600e75001c0ab3f2e8a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tim Henning
2019-10-17 16:20:13 +02:00
parent b90200cb19
commit 1673e692c5
6 changed files with 37 additions and 8 deletions

View File

@@ -47,11 +47,9 @@ void CtfStatisticsModel::beginLoading()
m_data.clear();
}
void CtfStatisticsModel::addEvent(const json &event, qint64 durationInNs)
void CtfStatisticsModel::addEvent(const QString &title, qint64 durationInNs)
{
const std::string name = event.value(CtfEventNameKey, "");
EventData &data = m_data[QString::fromStdString(name)];
EventData &data = m_data[title];
++data.count;
if (durationInNs >= 0) {
data.totalDuration += durationInNs;