forked from qt-creator/qt-creator
QmlProfiler: removed old fps code
Change-Id: If9ae003d1e6204450f931b72c950525b0b476f74 Reviewed-on: http://codereview.qt.nokia.com/1602 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
committed by
Aurindam Jana
parent
3cce72dcf5
commit
b533cea366
@@ -32,12 +32,9 @@
|
|||||||
|
|
||||||
.pragma library
|
.pragma library
|
||||||
|
|
||||||
var values = [ ]; //events
|
|
||||||
var ranges = [ ];
|
var ranges = [ ];
|
||||||
var frameFps = [ ];
|
|
||||||
var xmargin = 0;
|
var xmargin = 0;
|
||||||
var ymargin = 0;
|
var ymargin = 0;
|
||||||
var drawFpsGraph = false;
|
|
||||||
var nestingDepth = [];
|
var nestingDepth = [];
|
||||||
|
|
||||||
var names = [ "Painting", "Compiling", "Creating", "Binding", "Handling Signal"]
|
var names = [ "Painting", "Compiling", "Creating", "Binding", "Handling Signal"]
|
||||||
@@ -48,26 +45,12 @@ var xRayColors = [ "#6699CCB3", "#6699CCCC", "#6699B3CC", "#669999CC", "#66CC99B
|
|||||||
|
|
||||||
function reset()
|
function reset()
|
||||||
{
|
{
|
||||||
values = [];
|
|
||||||
ranges = [];
|
ranges = [];
|
||||||
frameFps = [];
|
|
||||||
xmargin = 0;
|
xmargin = 0;
|
||||||
ymargin = 0;
|
ymargin = 0;
|
||||||
nestingDepth = [];
|
nestingDepth = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcFps()
|
|
||||||
{
|
|
||||||
if (drawFpsGraph) {
|
|
||||||
if (values.length)
|
|
||||||
frameFps = new Array(values.length - 1);
|
|
||||||
for (var i = 0; i < values.length - 1; ++i) {
|
|
||||||
var frameTime = (values[i + 1] - values[i]) / 1000000;
|
|
||||||
frameFps[i] = 1000 / frameTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//draw background of the graph
|
//draw background of the graph
|
||||||
function drawGraph(canvas, ctxt, region)
|
function drawGraph(canvas, ctxt, region)
|
||||||
{
|
{
|
||||||
@@ -82,7 +65,7 @@ function drawGraph(canvas, ctxt, region)
|
|||||||
//draw the actual data to be graphed
|
//draw the actual data to be graphed
|
||||||
function drawData(canvas, ctxt, region)
|
function drawData(canvas, ctxt, region)
|
||||||
{
|
{
|
||||||
if (values.length == 0 && ranges.length == 0)
|
if (ranges.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var width = canvas.canvasSize.width - xmargin;
|
var width = canvas.canvasSize.width - xmargin;
|
||||||
@@ -114,24 +97,6 @@ function drawData(canvas, ctxt, region)
|
|||||||
highest[ranges[ii].type] = xx+size;
|
highest[ranges[ii].type] = xx+size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawFpsGraph) {
|
|
||||||
//draw fps overlay
|
|
||||||
var heightScale = height / 60;
|
|
||||||
ctxt.beginPath();
|
|
||||||
ctxt.moveTo(0,0);
|
|
||||||
for (var i = 1; i < values.length; ++i) {
|
|
||||||
var xx = (values[i] - ranges[0].start) * spacing + xmargin;
|
|
||||||
ctxt.lineTo(xx, height - frameFps[i-1]*heightScale)
|
|
||||||
}
|
|
||||||
ctxt.lineTo(width, 0);
|
|
||||||
ctxt.closePath();
|
|
||||||
var grad = ctxt.createLinearGradient(0, 0, 0, canvas.canvasSize.height);
|
|
||||||
grad.addColorStop(0, "rgba(255,128,128,.5)");
|
|
||||||
grad.addColorStop(1, "rgba(255,0,0,.5)");
|
|
||||||
ctxt.fillStyle = grad;
|
|
||||||
ctxt.fill();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function plot(canvas, ctxt, region)
|
function plot(canvas, ctxt, region)
|
||||||
@@ -142,7 +107,7 @@ function plot(canvas, ctxt, region)
|
|||||||
|
|
||||||
function xScale(canvas)
|
function xScale(canvas)
|
||||||
{
|
{
|
||||||
if (values.length === 0 && ranges.length === 0)
|
if (ranges.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var width = canvas.canvasSize.width - xmargin;
|
var width = canvas.canvasSize.width - xmargin;
|
||||||
|
|||||||
@@ -130,15 +130,6 @@ Rectangle {
|
|||||||
//handle debug data coming from C++
|
//handle debug data coming from C++
|
||||||
Connections {
|
Connections {
|
||||||
target: connection
|
target: connection
|
||||||
onEvent: {
|
|
||||||
if (root.dataAvailable) {
|
|
||||||
root.clearData();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!root.dataAvailable && event === 0) { //### only handle paint event
|
|
||||||
Plotter.values.push(time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onRange: {
|
onRange: {
|
||||||
if (root.dataAvailable) {
|
if (root.dataAvailable) {
|
||||||
@@ -161,7 +152,6 @@ Rectangle {
|
|||||||
|
|
||||||
onComplete: {
|
onComplete: {
|
||||||
root.dataAvailable = true;
|
root.dataAvailable = true;
|
||||||
Plotter.calcFps();
|
|
||||||
if (Plotter.ranges.length > 0) {
|
if (Plotter.ranges.length > 0) {
|
||||||
view.visible = true;
|
view.visible = true;
|
||||||
view.setRanges(Plotter.ranges);
|
view.setRanges(Plotter.ranges);
|
||||||
|
|||||||
Reference in New Issue
Block a user