Commit 79311f27 authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlProfiler: nesting events in the timeline view

Change-Id: I6bc534a7fc02cb8c647dfc90a78b698592719a91
Reviewed-on: http://codereview.qt.nokia.com/843

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 5525e7d2
......@@ -40,6 +40,7 @@ var valuesdone = false;
var xmargin = 0;
var ymargin = 0;
var drawFpsGraph = false;
var nestingDepth = [];
var names = [ "Painting", "Compiling", "Creating", "Binding", "Handling Signal"]
//### need better way to manipulate color from QML. In the meantime, these need to be kept in sync.
......@@ -55,6 +56,7 @@ function reset()
xmargin = 0;
ymargin = 0;
valuesdone = false;
nestingDepth = [];
}
function calcFps()
......
......@@ -146,8 +146,15 @@ Rectangle {
}
// todo: consider nestingLevel
if (!Plotter.valuesdone)
Plotter.ranges.push( { type: type, start: startTime, duration: length, label: data, fileName: fileName, line: line } );
if (!Plotter.valuesdone) {
if (!Plotter.nestingDepth[type])
Plotter.nestingDepth[type] = nestingInType;
else
Plotter.nestingDepth[type] = Math.max(Plotter.nestingDepth[type], nestingInType);
Plotter.ranges.push( { type: type, start: startTime, duration: length, label: data, fileName: fileName, line: line, nestingLevel: nestingInType, nestingDepth: Plotter.nestingDepth[type] } );
if (nestingInType == 1)
Plotter.nestingDepth[type] = 1;
}
}
onComplete: {
......@@ -265,8 +272,10 @@ Rectangle {
mouseArea.exited()
}
height: view.height / labels.rowCount
y: type * view.height / labels.rowCount;
property int baseY: type * view.height / labels.rowCount;
property int baseHeight: view.height / labels.rowCount
y: baseY + (nestingLevel-1)*(baseHeight / nestingDepth);
height: baseHeight / nestingDepth;
gradient: Gradient {
GradientStop { position: 0.0; color: myColor }
GradientStop { position: 0.5; color: Qt.darker(myColor, 1.1) }
......
......@@ -202,6 +202,8 @@ void TimelineView::updateTimeline(bool updateStartX)
ctxt->setContextProperty("fileName", m_ranges.property(i).property("fileName").toString());
ctxt->setContextProperty("line", m_ranges.property(i).property("line").toNumber());
ctxt->setContextProperty("index", i);
ctxt->setContextProperty("nestingLevel", m_ranges.property(i).property("nestingLevel").toNumber());
ctxt->setContextProperty("nestingDepth", m_ranges.property(i).property("nestingDepth").toNumber());
QString label;
QVariantList list = m_ranges.property(i).property("label").toVariant().value<QVariantList>();
for (int i = 0; i < list.size(); ++i) {
......@@ -226,7 +228,8 @@ void TimelineView::updateTimeline(bool updateStartX)
}
if (item) {
item->setX(m_starts.at(i)*spacing);
item->setWidth((m_ends.at(i)-m_starts.at(i)) * spacing);
qreal width = (m_ends.at(i)-m_starts.at(i)) * spacing;
item->setWidth(width > 1 ? width : 1);
item->setZValue(++z);
}
if (creating)
......
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