aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/qmlprofiler/qml/Overview.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/qmlprofiler/qml/Overview.js')
-rw-r--r--plugins/qmlprofiler/qml/Overview.js97
1 files changed, 44 insertions, 53 deletions
diff --git a/plugins/qmlprofiler/qml/Overview.js b/plugins/qmlprofiler/qml/Overview.js
index a3343591899..4ef2187b431 100644
--- a/plugins/qmlprofiler/qml/Overview.js
+++ b/plugins/qmlprofiler/qml/Overview.js
@@ -44,75 +44,66 @@ function drawData(canvas, ctxt, region)
if ((!qmlProfilerModelProxy) || qmlProfilerModelProxy.count() == 0)
return;
- var typeCount = 5;
var width = canvas.width;
var bump = 10;
var height = canvas.height - bump;
+
+ var typeCount = qmlProfilerModelProxy.visibleCategories();
var blockHeight = height / typeCount;
var spacing = width / qmlProfilerModelProxy.traceDuration();
- var highest = [0,0,0,0,0]; // note: change if typeCount changes
-
- for (var ii = 0; ii < qmlProfilerModelProxy.count(); ++ii) {
-
- var xx = (qmlProfilerModelProxy.getStartTime(ii) -
- qmlProfilerModelProxy.traceStartTime()) * spacing;
- if (xx > region.x + region.width)
- continue;
-
- var eventWidth = qmlProfilerModelProxy.getDuration(ii) * spacing;
- if (xx + eventWidth < region.x)
- continue;
-
- if (eventWidth < 1)
- eventWidth = 1;
-
- xx = Math.round(xx);
- var ty = qmlProfilerModelProxy.getType(ii);
-
- if (xx + eventWidth > highest[ty]) {
- /*
- // special: animations
- if (ty === 0 && qmlProfilerModelProxy.getAnimationCount(ii) >= 0) {
- var vertScale = qmlProfilerModelProxy.getMaximumAnimationCount() -
- qmlProfilerModelProxy.getMinimumAnimationCount();
- if (vertScale < 1)
- vertScale = 1;
- var fraction = (qmlProfilerModelProxy.getAnimationCount(ii) -
- qmlProfilerModelProxy.getMinimumAnimationCount()) / vertScale;
- var eventHeight = blockHeight * (fraction * 0.85 + 0.15);
- var yy = bump + ty*blockHeight + blockHeight - eventHeight;
-
- var fpsFraction = qmlProfilerModelProxy.getFramerate(ii) / 60.0;
- if (fpsFraction > 1.0)
- fpsFraction = 1.0;
- ctxt.fillStyle = "hsl("+(fpsFraction*0.27+0.028)+",0.3,0.65)";
- ctxt.fillRect(xx, yy, eventWidth, eventHeight);
- } else { */
- var hue = ( qmlProfilerModelProxy.getEventId(ii) * 25 ) % 360;
- ctxt.fillStyle = "hsl("+(hue/360.0+0.001)+",0.3,0.65)";
- ctxt.fillRect(xx, bump + ty*blockHeight, eventWidth, blockHeight);
- /*}*/
- highest[ty] = xx+eventWidth;
+ var modelRowStart = 0;
+ for (var modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount(); modelIndex++) {
+ for (var ii = 0; ii < qmlProfilerModelProxy.count(modelIndex); ++ii) {
+
+ var xx = (qmlProfilerModelProxy.getStartTime(modelIndex,ii) -
+ qmlProfilerModelProxy.traceStartTime()) * spacing;
+ if (xx > region.x + region.width)
+ continue;
+
+ var eventWidth = qmlProfilerModelProxy.getDuration(modelIndex,ii) * spacing;
+ if (xx + eventWidth < region.x)
+ continue;
+
+ if (eventWidth < 1)
+ eventWidth = 1;
+
+ xx = Math.round(xx);
+
+ var rowNumber = modelRowStart + qmlProfilerModelProxy.getEventCategoryInModel(modelIndex, ii);
+
+ var itemHeight = qmlProfilerModelProxy.getHeight(modelIndex,ii) * blockHeight;
+ var yy = (rowNumber + 1) * blockHeight - itemHeight ;
+
+ var itemColor = qmlProfilerModelProxy.getColorRGB(modelIndex, ii);
+ ctxt.fillStyle = "rgb("+itemColor[0]+","+itemColor[1]+","+itemColor[2]+")";
+ ctxt.fillRect(xx, bump + yy, eventWidth, itemHeight);
}
+ modelRowStart += qmlProfilerModelProxy.categoryCount(modelIndex);
}
// binding loops
ctxt.strokeStyle = "orange";
ctxt.lineWidth = 2;
var radius = 1;
- for (var ii = 0; ii < qmlProfilerModelProxy.count(); ++ii) {
- if (qmlProfilerModelProxy.getBindingLoopDest(ii) >= 0) {
- var xcenter = Math.round(qmlProfilerModelProxy.getStartTime(ii) +
- qmlProfilerModelProxy.getDuration(ii) -
- qmlProfilerModelProxy.traceStartTime()) * spacing;
- var ycenter = Math.round(bump + qmlProfilerModelProxy.getType(ii) *
- blockHeight + blockHeight/2);
- ctxt.arc(xcenter, ycenter, radius, 0, 2*Math.PI, true);
- ctxt.stroke();
+ modelRowStart = 0;
+ for (modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount(); modelIndex++) {
+ for (ii = 0; ii < qmlProfilerModelProxy.count(modelIndex); ++ii) {
+ if (qmlProfilerModelProxy.getBindingLoopDest(modelIndex,ii) >= 0) {
+ var xcenter = Math.round(qmlProfilerModelProxy.getStartTime(modelIndex,ii) +
+ qmlProfilerModelProxy.getDuration(modelIndex,ii) -
+ qmlProfilerModelProxy.traceStartTime()) * spacing;
+ var ycenter = Math.round(bump + (modelRowStart +
+ qmlProfilerModelProxy.getEventCategoryInModel(modelIndex, ii)) *
+ blockHeight + blockHeight/2);
+ ctxt.arc(xcenter, ycenter, radius, 0, 2*Math.PI, true);
+ ctxt.stroke();
+ }
}
+ modelRowStart += qmlProfilerModelProxy.categoryCount(modelIndex);
}
+
}
function drawTimeBar(canvas, ctxt, region)