forked from qt-creator/qt-creator
QmlProfiler: display animation traces from Qt5
Change-Id: I7959052ec07089419e85186b0b0e58f911e273ec Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -73,9 +73,25 @@ function drawData(canvas, ctxt, region)
|
||||
xx = Math.round(xx);
|
||||
var ty = qmlEventList.getType(ii);
|
||||
if (xx + eventWidth > highest[ty]) {
|
||||
var hue = ( qmlEventList.getEventId(ii) * 25 ) % 360;
|
||||
ctxt.fillStyle = "hsl("+(hue/360.0+0.001)+",0.3,0.65)";
|
||||
ctxt.fillRect(xx, bump + ty*blockHeight, eventWidth, blockHeight);
|
||||
// special: animations
|
||||
if (ty === 0 && qmlEventList.getAnimationCount(ii) >= 0) {
|
||||
var vertScale = qmlEventList.getMaximumAnimationCount() - qmlEventList.getMinimumAnimationCount();
|
||||
if (vertScale < 1)
|
||||
vertScale = 1;
|
||||
var fraction = (qmlEventList.getAnimationCount(ii) - qmlEventList.getMinimumAnimationCount()) / vertScale;
|
||||
var eventHeight = blockHeight * (fraction * 0.85 + 0.15);
|
||||
var yy = bump + ty*blockHeight + blockHeight - eventHeight;
|
||||
|
||||
var fpsFraction = qmlEventList.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 = ( qmlEventList.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +123,10 @@ QColor TimelineView::colorForItem(int itemIndex)
|
||||
|
||||
void TimelineView::drawItemsToPainter(QPainter *p, int fromIndex, int toIndex)
|
||||
{
|
||||
int x,y,width,rowNumber, eventType;
|
||||
int x, y, width, height, rowNumber, eventType;
|
||||
for (int i = fromIndex; i <= toIndex; i++) {
|
||||
x = (m_eventList->getStartTime(i) - m_startTime) * m_spacing;
|
||||
|
||||
eventType = m_eventList->getType(i);
|
||||
if (m_rowsExpanded[eventType])
|
||||
y = m_rowStarts[eventType] + DefaultRowHeight*(m_eventList->eventPosInType(i) + 1);
|
||||
@@ -141,8 +142,25 @@ void TimelineView::drawItemsToPainter(QPainter *p, int fromIndex, int toIndex)
|
||||
continue;
|
||||
m_rowLastX[rowNumber] = x+width;
|
||||
|
||||
p->setBrush(colorForItem(i));
|
||||
p->drawRect(x,y,width,DefaultRowHeight);
|
||||
// special: animations
|
||||
if (eventType == 0 && m_eventList->getAnimationCount(i) >= 0) {
|
||||
double scale = m_eventList->getMaximumAnimationCount() - m_eventList->getMinimumAnimationCount();
|
||||
if (scale < 1)
|
||||
scale = 1;
|
||||
double fraction = (double)(m_eventList->getAnimationCount(i) - m_eventList->getMinimumAnimationCount()) / scale;
|
||||
height = DefaultRowHeight * (fraction * 0.85 + 0.15);
|
||||
y += DefaultRowHeight - height;
|
||||
|
||||
double fpsFraction = m_eventList->getFramerate(i) / 60.0;
|
||||
if (fpsFraction > 1.0)
|
||||
fpsFraction = 1.0;
|
||||
p->setBrush(QColor::fromHsl((fpsFraction*96)+10, 76, 166));
|
||||
p->drawRect(x, y, width, height);
|
||||
} else {
|
||||
// normal events
|
||||
p->setBrush(colorForItem(i));
|
||||
p->drawRect(x, y, width, DefaultRowHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ TraceWindow::TraceWindow(QWidget *parent)
|
||||
connect(this,SIGNAL(range(int,qint64,qint64,QStringList,QString,int)), m_eventList, SLOT(addRangedEvent(int,qint64,qint64,QStringList,QString,int)));
|
||||
connect(this, SIGNAL(traceFinished(qint64)), m_eventList, SLOT(setTraceEndTime(qint64)));
|
||||
connect(this, SIGNAL(traceStarted(qint64)), m_eventList, SLOT(setTraceStartTime(qint64)));
|
||||
connect(this, SIGNAL(frameEvent(qint64,int,int)), m_eventList, SLOT(addFrameEvent(qint64,int,int)));
|
||||
connect(this,SIGNAL(viewUpdated()), m_eventList, SLOT(complete()));
|
||||
m_mainView->rootContext()->setContextProperty("qmlEventList", m_eventList);
|
||||
m_overview->rootContext()->setContextProperty("qmlEventList", m_eventList);
|
||||
@@ -311,6 +312,7 @@ void TraceWindow::connectClientSignals()
|
||||
this, SIGNAL(range(int,qint64,qint64,QStringList,QString,int)));
|
||||
connect(m_plugin.data(), SIGNAL(traceFinished(qint64)), this, SIGNAL(traceFinished(qint64)));
|
||||
connect(m_plugin.data(), SIGNAL(traceStarted(qint64)), this, SIGNAL(traceStarted(qint64)));
|
||||
connect(m_plugin.data(), SIGNAL(frame(qint64,int,int)), this, SIGNAL(frameEvent(qint64,int,int)));
|
||||
connect(m_plugin.data(), SIGNAL(enabledChanged()), this, SLOT(updateProfilerState()));
|
||||
connect(m_plugin.data(), SIGNAL(enabledChanged()), m_plugin.data(), SLOT(sendRecordingStatus()));
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ signals:
|
||||
int lineNumber, double totalTime, double selfTime);
|
||||
void traceFinished(qint64);
|
||||
void traceStarted(qint64);
|
||||
void frameEvent(qint64, int, int);
|
||||
|
||||
void internalClearDisplay();
|
||||
void jumpToPrev();
|
||||
|
||||
Reference in New Issue
Block a user