QmlProfiler: Don't trust in externally provided timestamps

We might get timestamps that are outside the trace time, negative
timestamps, ranges that go backwards, and other insane things.

In order to deal with this, we clamp all negative timestamps to 0, and
treat the specified trace time as minimum range, that can be overridden
by events.

Change-Id: Iba661f2a4346077871fc62a46759e169b2aad49d
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
This commit is contained in:
Ulf Hermann
2017-09-08 17:35:28 +02:00
parent 8fa07c81f6
commit 9cdb0ec22e
6 changed files with 28 additions and 13 deletions

View File

@@ -247,7 +247,7 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
const QmlDebug::QDebugContextInfo &context)
{
d->updateFeatures(ProfileDebugMessages);
d->currentEvent.event.setTimestamp(context.timestamp);
d->currentEvent.event.setTimestamp(context.timestamp > 0 ? context.timestamp : 0);
d->currentEvent.event.setTypeIndex(-1);
d->currentEvent.event.setString(text);
d->currentEvent.type = QmlEventType(DebugMessage, MaximumRangeType, type,