Commit 834883b0 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Support additional attributes of input events

Change-Id: I92a28d0476ad814601f33b76e508bdbea02eefff
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent db64434b
......@@ -91,6 +91,21 @@ enum PixmapEventType {
MaximumPixmapEventType
};
enum InputEventType {
InputKeyPress,
InputKeyRelease,
InputKeyUnknown,
InputMousePress,
InputMouseRelease,
InputMouseMove,
InputMouseDoubleClick,
InputMouseWheel,
InputMouseUnknown,
MaximumInputEventType
};
enum SceneGraphFrameType {
SceneGraphRendererFrame, // Render Thread
SceneGraphAdaptationLayerFrame, // Render Thread
......
......@@ -251,9 +251,18 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
case Mouse:
if (!d->updateFeatures(ProfileInputEvents))
break;
int inputType = (subtype == Key ? InputKeyUnknown : InputMouseUnknown);
if (!stream.atEnd())
stream >> inputType;
int a = -1;
if (!stream.atEnd())
stream >> a;
int b = -1;
if (!stream.atEnd())
stream >> b;
emit this->rangedEvent(Event, MaximumRangeType, subtype, time, 0, QString(),
QmlEventLocation(), 0, 0, 0, 0, 0);
emit rangedEvent(Event, MaximumRangeType, subtype, time, 0, QString(),
QmlEventLocation(), inputType, a, b, 0, 0);
d->maximumTime = qMax(time, d->maximumTime);
break;
}
......
......@@ -411,6 +411,12 @@ void QmlProfilerFileReader::loadProfilerDataModel(QXmlStreamReader &stream)
range.numericData4 = attributes.value(_("timing4")).toString().toLongLong();
if (attributes.hasAttribute(_("timing5")))
range.numericData5 = attributes.value(_("timing5")).toString().toLongLong();
if (attributes.hasAttribute(_("type")))
range.numericData1 = attributes.value(_("type")).toString().toLongLong();
if (attributes.hasAttribute(_("data1")))
range.numericData2 = attributes.value(_("data1")).toString().toLongLong();
if (attributes.hasAttribute(_("data2")))
range.numericData3 = attributes.value(_("data2")).toString().toLongLong();
range.typeIndex = attributes.value(_("eventIndex")).toString().toInt();
......@@ -601,11 +607,19 @@ void QmlProfilerFileWriter::save(QIODevice *device)
const QmlProfilerDataModel::QmlEventTypeData &event = m_qmlEvents[range.typeIndex];
// special: animation event
if (event.message == Event && event.detailType == AnimationFrame) {
stream.writeAttribute(_("framerate"), QString::number(range.numericData1));
stream.writeAttribute(_("animationcount"), QString::number(range.numericData2));
stream.writeAttribute(_("thread"), QString::number(range.numericData3));
if (event.message == Event) {
if (event.detailType == AnimationFrame) {
// special: animation event
stream.writeAttribute(_("framerate"), QString::number(range.numericData1));
stream.writeAttribute(_("animationcount"), QString::number(range.numericData2));
stream.writeAttribute(_("thread"), QString::number(range.numericData3));
} else if (event.detailType == Key || event.detailType == Mouse) {
// special: input event
stream.writeAttribute(_("type"), QString::number(range.numericData1));
stream.writeAttribute(_("data1"), QString::number(range.numericData2));
stream.writeAttribute(_("data2"), QString::number(range.numericData3));
}
}
// special: pixmap cache event
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment