forked from qt-creator/qt-creator
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:
@@ -23,15 +23,17 @@ using json = nlohmann::json;
|
||||
using namespace Constants;
|
||||
|
||||
CtfTimelineModel::CtfTimelineModel(Timeline::TimelineModelAggregator *parent,
|
||||
CtfTraceManager *traceManager, int tid, int pid)
|
||||
: Timeline::TimelineModel (parent)
|
||||
CtfTraceManager *traceManager,
|
||||
const QString &tid,
|
||||
const QString &pid)
|
||||
: Timeline::TimelineModel(parent)
|
||||
, m_traceManager(traceManager)
|
||||
, m_threadId(tid)
|
||||
, m_processId(pid)
|
||||
{
|
||||
updateName();
|
||||
setCollapsedRowCount(1);
|
||||
setCategoryColor(colorByHue(pid * 25));
|
||||
setCategoryColor(colorByHue(qHash(pid)));
|
||||
setHasMixedTypesInExpandedState(true);
|
||||
}
|
||||
|
||||
@@ -199,7 +201,7 @@ void CtfTimelineModel::finalize(double traceBegin, double traceEnd, const QStrin
|
||||
emit contentChanged();
|
||||
}
|
||||
|
||||
int CtfTimelineModel::tid() const
|
||||
QString CtfTimelineModel::tid() const
|
||||
{
|
||||
return m_threadId;
|
||||
}
|
||||
@@ -218,13 +220,13 @@ void CtfTimelineModel::updateName()
|
||||
if (m_threadName.isEmpty()) {
|
||||
setDisplayName(Tr::tr("Thread %1").arg(m_threadId));
|
||||
} else {
|
||||
setDisplayName(QString("%1 (%2)").arg(m_threadName).arg(m_threadId));
|
||||
setDisplayName(QString("%1 (%2)").arg(m_threadName, m_threadId));
|
||||
}
|
||||
QString process = m_processName.isEmpty() ? QString::number(m_processId) :
|
||||
QString("%1 (%2)").arg(m_processName).arg(m_processId);
|
||||
QString thread = m_threadName.isEmpty() ? QString::number(m_threadId) :
|
||||
QString("%1 (%2)").arg(m_threadName).arg(m_threadId);
|
||||
setTooltip(QString("Process: %1\nThread: %2").arg(process).arg(thread));
|
||||
QString process = m_processName.isEmpty() ? m_processId
|
||||
: QString("%1 (%2)").arg(m_processName, m_processId);
|
||||
QString thread = m_threadName.isEmpty() ? m_threadId
|
||||
: QString("%1 (%2)").arg(m_threadName, m_threadId);
|
||||
setTooltip(QString("Process: %1\nThread: %2").arg(process, thread));
|
||||
}
|
||||
|
||||
qint64 CtfTimelineModel::newStackEvent(const json &event, qint64 normalizedTime,
|
||||
|
||||
Reference in New Issue
Block a user