forked from qt-creator/qt-creator
QmlProfiler: nonzero trace starttimes
Change-Id: I734c1af79a4975f5f331f212721331ea877b391a Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -79,7 +79,7 @@ Rectangle {
|
||||
backgroundMarks.updateMarks(startTime, endTime);
|
||||
view.updateFlickRange(startTime, endTime);
|
||||
if (duration > 0) {
|
||||
var candidateWidth = qmlEventList.traceEndTime() * flick.width / duration;
|
||||
var candidateWidth = qmlEventList.traceDuration() * flick.width / duration;
|
||||
if (flick.contentWidth !== candidateWidth)
|
||||
flick.contentWidth = candidateWidth;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ Rectangle {
|
||||
dataAvailable = true;
|
||||
view.visible = true;
|
||||
view.requestPaint();
|
||||
zoomControl.setRange(0, qmlEventList.traceEndTime()/10);
|
||||
zoomControl.setRange(qmlEventList.traceStartTime(), qmlEventList.traceStartTime() + qmlEventList.traceDuration()/10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,9 +152,9 @@ Rectangle {
|
||||
|
||||
function updateWindowLength(absoluteFactor) {
|
||||
var windowLength = view.endTime - view.startTime;
|
||||
if (qmlEventList.traceEndTime() <= 0 || windowLength <= 0)
|
||||
if (qmlEventList.traceEndTime() <= qmlEventList.traceStartTime() || windowLength <= 0)
|
||||
return;
|
||||
var currentFactor = windowLength / qmlEventList.traceEndTime();
|
||||
var currentFactor = windowLength / qmlEventList.traceDuration();
|
||||
updateZoom(absoluteFactor / currentFactor);
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ Rectangle {
|
||||
windowLength = min_length;
|
||||
var newWindowLength = windowLength * relativeFactor;
|
||||
|
||||
if (newWindowLength > qmlEventList.traceEndTime()) {
|
||||
newWindowLength = qmlEventList.traceEndTime();
|
||||
if (newWindowLength > qmlEventList.traceDuration()) {
|
||||
newWindowLength = qmlEventList.traceDuration();
|
||||
relativeFactor = newWindowLength / windowLength;
|
||||
}
|
||||
if (newWindowLength < min_length) {
|
||||
@@ -194,8 +194,8 @@ Rectangle {
|
||||
windowLength = min_length;
|
||||
var newWindowLength = windowLength * relativeFactor;
|
||||
|
||||
if (newWindowLength > qmlEventList.traceEndTime()) {
|
||||
newWindowLength = qmlEventList.traceEndTime();
|
||||
if (newWindowLength > qmlEventList.traceDuration()) {
|
||||
newWindowLength = qmlEventList.traceDuration();
|
||||
relativeFactor = newWindowLength / windowLength;
|
||||
}
|
||||
if (newWindowLength < min_length) {
|
||||
@@ -223,7 +223,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function wheelZoom(wheelCenter, wheelDelta) {
|
||||
if (qmlEventList.traceEndTime()>0 && wheelDelta!=0) {
|
||||
if (qmlEventList.traceEndTime() > qmlEventList.traceStartTime() && wheelDelta !== 0) {
|
||||
if (wheelDelta>0)
|
||||
updateZoomCentered(wheelCenter, 1/1.2);
|
||||
else
|
||||
@@ -339,9 +339,9 @@ Rectangle {
|
||||
|
||||
property variant startX: 0
|
||||
onStartXChanged: {
|
||||
var newStartTime = Math.round(startX * (endTime - startTime) / flick.width);
|
||||
var newStartTime = Math.round(startX * (endTime - startTime) / flick.width) + qmlEventList.traceStartTime();
|
||||
if (Math.abs(newStartTime - startTime) > 1) {
|
||||
var newEndTime = Math.round((startX+flick.width)* (endTime - startTime) / flick.width);
|
||||
var newEndTime = Math.round((startX+flick.width)* (endTime - startTime) / flick.width) + qmlEventList.traceStartTime();
|
||||
zoomControl.setRange(newStartTime, newEndTime);
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ Rectangle {
|
||||
if (start !== startTime || end !== endTime) {
|
||||
startTime = start;
|
||||
endTime = end;
|
||||
var newStartX = startTime * flick.width / (endTime-startTime);
|
||||
var newStartX = (startTime - qmlEventList.traceStartTime()) * flick.width / (endTime-startTime);
|
||||
if (Math.abs(newStartX - startX) >= 1)
|
||||
startX = newStartX;
|
||||
}
|
||||
|
||||
@@ -54,8 +54,7 @@ function drawData(canvas, ctxt, region)
|
||||
var width = canvas.width;
|
||||
var height = canvas.height;
|
||||
|
||||
var sumValue = qmlEventList.traceEndTime() - qmlEventList.traceStartTime();
|
||||
var spacing = width / sumValue;
|
||||
var spacing = width / qmlEventList.traceDuration();
|
||||
|
||||
ctxt.fillStyle = "rgba(0,0,0,1)";
|
||||
var highest = [0,0,0,0,0];
|
||||
|
||||
@@ -51,8 +51,8 @@ Canvas2D {
|
||||
}
|
||||
|
||||
function updateRange() {
|
||||
var newStartTime = Math.round(rangeMover.x * qmlEventList.traceEndTime() / width);
|
||||
var newEndTime = Math.round((rangeMover.x + rangeMover.width) * qmlEventList.traceEndTime() / width);
|
||||
var newStartTime = Math.round(rangeMover.x * qmlEventList.traceDuration() / width) + qmlEventList.traceStartTime();
|
||||
var newEndTime = Math.round((rangeMover.x + rangeMover.width) * qmlEventList.traceDuration() / width) + qmlEventList.traceStartTime();
|
||||
if (startTime !== newStartTime || endTime !== newEndTime) {
|
||||
zoomControl.setRange(newStartTime, newEndTime);
|
||||
}
|
||||
@@ -65,10 +65,10 @@ Canvas2D {
|
||||
if (qmlEventList) {
|
||||
startTime = zoomControl.startTime();
|
||||
endTime = zoomControl.endTime();
|
||||
var newRangeX = startTime * width / qmlEventList.traceEndTime();
|
||||
var newRangeX = (startTime - qmlEventList.traceStartTime()) * width / qmlEventList.traceDuration();
|
||||
if (rangeMover.x !== newRangeX)
|
||||
rangeMover.x = newRangeX;
|
||||
var newWidth = (endTime-startTime) * width / qmlEventList.traceEndTime();
|
||||
var newWidth = (endTime-startTime) * width / qmlEventList.traceDuration();
|
||||
if (rangeMover.width !== newWidth)
|
||||
rangeMover.width = newWidth;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ Rectangle {
|
||||
property string endTimeString: detailedPrintTime(startTime+duration)
|
||||
property string durationString: detailedPrintTime(duration)
|
||||
|
||||
property variant startTime: x * selectionRange.viewTimePerPixel
|
||||
property variant startTime: x * selectionRange.viewTimePerPixel + qmlEventList.traceStartTime()
|
||||
property variant duration: width * selectionRange.viewTimePerPixel
|
||||
property variant viewTimePerPixel: 1
|
||||
property variant creationState : 0
|
||||
|
||||
@@ -117,6 +117,7 @@ TraceWindow::TraceWindow(QWidget *parent)
|
||||
m_eventList = new QmlProfilerEventList(this);
|
||||
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(viewUpdated()), m_eventList, SLOT(complete()));
|
||||
m_mainView->rootContext()->setContextProperty("qmlEventList", m_eventList);
|
||||
m_overview->rootContext()->setContextProperty("qmlEventList", m_eventList);
|
||||
@@ -256,6 +257,7 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
|
||||
connect(m_v8plugin.data(), SIGNAL(complete()), this, SLOT(v8Complete()));
|
||||
connect(m_v8plugin.data(), SIGNAL(v8range(int,QString,QString,int,double,double)), this, SIGNAL(v8range(int,QString,QString,int,double,double)));
|
||||
connect(m_plugin.data(), SIGNAL(traceFinished(qint64)), this, SIGNAL(traceFinished(qint64)));
|
||||
connect(m_plugin.data(), SIGNAL(traceStarted(qint64)), this, SIGNAL(traceStarted(qint64)));
|
||||
|
||||
m_mainView->rootContext()->setContextProperty("connection", m_plugin.data());
|
||||
m_mainView->rootContext()->setContextProperty("zoomControl", m_zoomControl.data());
|
||||
@@ -448,10 +450,9 @@ void TraceWindow::updateRange()
|
||||
qreal duration = m_zoomControl.data()->endTime() - m_zoomControl.data()->startTime();
|
||||
if (duration <= 0)
|
||||
return;
|
||||
qreal totalTime = m_eventList->traceEndTime() - m_eventList->traceStartTime();
|
||||
if (totalTime <= 0)
|
||||
if (m_eventList->traceDuration() <= 0)
|
||||
return;
|
||||
int newLevel = pow(duration / totalTime, 1/sliderExp) * sliderTicks;
|
||||
int newLevel = pow(duration / m_eventList->traceDuration(), 1/sliderExp) * sliderTicks;
|
||||
if (m_currentZoomLevel != newLevel) {
|
||||
m_currentZoomLevel = newLevel;
|
||||
emit zoomLevelChanged(newLevel);
|
||||
|
||||
@@ -121,6 +121,7 @@ signals:
|
||||
void v8range(int depth,const QString &function,const QString &filename,
|
||||
int lineNumber, double totalTime, double selfTime);
|
||||
void traceFinished(qint64);
|
||||
void traceStarted(qint64);
|
||||
|
||||
void internalClearDisplay();
|
||||
void jumpToPrev();
|
||||
|
||||
Reference in New Issue
Block a user