CtfVisualizer: Allow strings for process and thread id

While the format document only uses numbers for these in its examples,
the data type is not really specified there and chrome://tracing itself
handles strings for them without complaint. On trace-generating side
std::thread::id can't easily be serialized as a number, and strings can
easily be supported in the viewer.

Change-Id: I36c8497049d4933058b9f72a28f24e1d1cf0d5bb
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2023-09-08 10:17:29 +02:00
parent 67aab38873
commit c83047abb9
5 changed files with 48 additions and 32 deletions

View File

@@ -43,15 +43,14 @@ public:
QList<CtfTimelineModel *> getSortedThreads() const;
void setThreadRestriction(int tid, bool restrictToThisThread);
bool isRestrictedTo(int tid) const;
void setThreadRestriction(const QString &tid, bool restrictToThisThread);
bool isRestrictedTo(const QString &tid) const;
signals:
void detailsRequested(const QString &title);
protected:
void addModelForThread(int threadId, int processId);
void addModelForThread(const QString &threadId, const QString &processId);
void addModelsToAggregator();
void updateStatistics();
@@ -61,11 +60,11 @@ protected:
Timeline::TimelineModelAggregator *const m_modelAggregator;
CtfStatisticsModel *const m_statisticsModel;
QHash<qint64, CtfTimelineModel *> m_threadModels;
QHash<qint64, QString> m_processNames;
QHash<qint64, QString> m_threadNames;
QHash<QString, CtfTimelineModel *> m_threadModels;
QHash<QString, QString> m_processNames;
QHash<QString, QString> m_threadNames;
QMap<std::string, int> m_name2selectionId;
QHash<qint64, bool> m_threadRestrictions;
QHash<QString, bool> m_threadRestrictions;
double m_traceBegin = std::numeric_limits<double>::max();
double m_traceEnd = std::numeric_limits<double>::min();