2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company,
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2019-08-29 11:45:45 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-09-02 09:59:14 +02:00
|
|
|
#include "json/json.hpp"
|
2019-08-29 11:45:45 +02:00
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
|
|
namespace Timeline {
|
|
|
|
|
class TimelineModelAggregator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace CtfVisualizer {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class CtfStatisticsModel;
|
|
|
|
|
class CtfTimelineModel;
|
|
|
|
|
|
|
|
|
|
class CtfTraceManager : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit CtfTraceManager(QObject *parent,
|
|
|
|
|
Timeline::TimelineModelAggregator *modelAggregator,
|
|
|
|
|
CtfStatisticsModel *statisticsModel);
|
|
|
|
|
|
|
|
|
|
qint64 traceDuration() const;
|
|
|
|
|
qint64 traceBegin() const;
|
|
|
|
|
qint64 traceEnd() const;
|
|
|
|
|
|
|
|
|
|
void addEvent(const nlohmann::json &event);
|
|
|
|
|
|
|
|
|
|
void load(const QString &filename);
|
|
|
|
|
void finalize();
|
|
|
|
|
|
|
|
|
|
bool isEmpty() const;
|
|
|
|
|
|
|
|
|
|
int getSelectionId(const std::string &name);
|
|
|
|
|
|
2019-10-17 13:36:37 +02:00
|
|
|
QList<CtfTimelineModel *> getSortedThreads() const;
|
|
|
|
|
|
|
|
|
|
void setThreadRestriction(int tid, bool restrictToThisThread);
|
|
|
|
|
bool isRestrictedTo(int tid) const;
|
|
|
|
|
|
2019-08-29 11:45:45 +02:00
|
|
|
signals:
|
|
|
|
|
void detailsRequested(const QString &title);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
void addModelForThread(int threadId, int processId);
|
|
|
|
|
void addModelsToAggregator();
|
|
|
|
|
|
2019-10-17 16:20:13 +02:00
|
|
|
void updateStatistics();
|
|
|
|
|
|
2019-08-29 11:45:45 +02:00
|
|
|
void clearAll();
|
|
|
|
|
|
|
|
|
|
Timeline::TimelineModelAggregator *const m_modelAggregator;
|
|
|
|
|
CtfStatisticsModel *const m_statisticsModel;
|
|
|
|
|
|
|
|
|
|
QHash<qint64, CtfTimelineModel *> m_threadModels;
|
|
|
|
|
QHash<qint64, QString> m_processNames;
|
|
|
|
|
QHash<qint64, QString> m_threadNames;
|
|
|
|
|
QMap<std::string, int> m_name2selectionId;
|
2019-10-17 13:36:37 +02:00
|
|
|
QHash<qint64, bool> m_threadRestrictions;
|
2019-08-29 11:45:45 +02:00
|
|
|
|
|
|
|
|
double m_traceBegin = std::numeric_limits<double>::max();
|
|
|
|
|
double m_traceEnd = std::numeric_limits<double>::min();
|
|
|
|
|
double m_timeOffset = -1.0;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CtfVisualizer
|