forked from qt-creator/qt-creator
QmlProfiler: timers for all profiler activities
Change-Id: I2ecbf4d1d90e353506e7c164560b69b81fcc6c66 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -146,10 +146,12 @@ TraceWindow::TraceWindow(QWidget *parent)
|
||||
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
|
||||
setMinimumHeight(170);
|
||||
m_currentZoomLevel = 0;
|
||||
m_profiledTime = 0;
|
||||
}
|
||||
|
||||
TraceWindow::~TraceWindow()
|
||||
{
|
||||
disconnectClientSignals();
|
||||
delete m_plugin.data();
|
||||
delete m_v8plugin.data();
|
||||
}
|
||||
@@ -258,24 +260,14 @@ QWidget *TraceWindow::createZoomToolbar()
|
||||
|
||||
void TraceWindow::reset(QDeclarativeDebugConnection *conn)
|
||||
{
|
||||
if (m_plugin)
|
||||
disconnect(m_plugin.data(), SIGNAL(complete()), this, SLOT(qmlComplete()));
|
||||
disconnectClientSignals();
|
||||
|
||||
delete m_plugin.data();
|
||||
m_plugin = new QmlProfilerTraceClient(conn);
|
||||
connect(m_plugin.data(), SIGNAL(complete()), this, SLOT(qmlComplete()));
|
||||
connect(m_plugin.data(), SIGNAL(range(int,qint64,qint64,QStringList,QString,int)),
|
||||
this, SIGNAL(range(int,qint64,qint64,QStringList,QString,int)));
|
||||
|
||||
if (m_v8plugin) {
|
||||
disconnect(m_v8plugin.data(), SIGNAL(complete()), this, SLOT(v8Complete()));
|
||||
disconnect(m_v8plugin.data(), SIGNAL(v8range(int,QString,QString,int,double,double)), this, SIGNAL(v8range(int,QString,QString,int,double,double)));
|
||||
}
|
||||
delete m_v8plugin.data();
|
||||
m_v8plugin = new QV8ProfilerClient(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)));
|
||||
|
||||
connectClientSignals();
|
||||
|
||||
m_mainView->rootContext()->setContextProperty("connection", m_plugin.data());
|
||||
m_mainView->rootContext()->setContextProperty("zoomControl", m_zoomControl.data());
|
||||
@@ -311,6 +303,40 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
|
||||
m_qmlDataReady = false;
|
||||
}
|
||||
|
||||
void TraceWindow::connectClientSignals()
|
||||
{
|
||||
if (m_plugin) {
|
||||
connect(m_plugin.data(), SIGNAL(complete()), this, SLOT(qmlComplete()));
|
||||
connect(m_plugin.data(), SIGNAL(range(int,qint64,qint64,QStringList,QString,int)),
|
||||
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(enabledChanged()), this, SLOT(updateProfilerState()));
|
||||
}
|
||||
if (m_v8plugin) {
|
||||
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_v8plugin.data(), SIGNAL(enabledChanged()), this, SLOT(updateProfilerState()));
|
||||
}
|
||||
}
|
||||
|
||||
void TraceWindow::disconnectClientSignals()
|
||||
{
|
||||
if (m_plugin) {
|
||||
disconnect(m_plugin.data(), SIGNAL(complete()), this, SLOT(qmlComplete()));
|
||||
disconnect(m_plugin.data(), SIGNAL(range(int,qint64,qint64,QStringList,QString,int)),
|
||||
this, SIGNAL(range(int,qint64,qint64,QStringList,QString,int)));
|
||||
disconnect(m_plugin.data(), SIGNAL(traceFinished(qint64)), this, SIGNAL(traceFinished(qint64)));
|
||||
disconnect(m_plugin.data(), SIGNAL(traceStarted(qint64)), this, SIGNAL(traceStarted(qint64)));
|
||||
disconnect(m_plugin.data(), SIGNAL(enabledChanged()), this, SLOT(updateProfilerState()));
|
||||
}
|
||||
if (m_v8plugin) {
|
||||
disconnect(m_v8plugin.data(), SIGNAL(complete()), this, SLOT(v8Complete()));
|
||||
disconnect(m_v8plugin.data(), SIGNAL(v8range(int,QString,QString,int,double,double)), this, SIGNAL(v8range(int,QString,QString,int,double,double)));
|
||||
disconnect(m_v8plugin.data(), SIGNAL(enabledChanged()), this, SLOT(updateProfilerState()));
|
||||
}
|
||||
}
|
||||
|
||||
QmlProfilerEventList *TraceWindow::getEventList() const
|
||||
{
|
||||
return m_eventList;
|
||||
@@ -334,7 +360,12 @@ void TraceWindow::updateCursorPosition()
|
||||
|
||||
void TraceWindow::updateTimer()
|
||||
{
|
||||
emit timeChanged(m_mainView->rootObject()->property("elapsedTime").toDouble());
|
||||
m_profiledTime = m_mainView->rootObject()->property("elapsedTime").toDouble();
|
||||
}
|
||||
|
||||
double TraceWindow::profiledTime() const
|
||||
{
|
||||
return m_profiledTime;
|
||||
}
|
||||
|
||||
void TraceWindow::clearDisplay()
|
||||
@@ -347,6 +378,7 @@ void TraceWindow::clearDisplay()
|
||||
m_v8plugin.data()->clearData();
|
||||
|
||||
m_zoomControl.data()->setRange(0,0);
|
||||
m_profiledTime = 0;
|
||||
|
||||
emit internalClearDisplay();
|
||||
}
|
||||
@@ -513,5 +545,17 @@ void TraceWindow::selectNextEvent(int eventId)
|
||||
emit selectNextEventInDisplay(QVariant(eventId));
|
||||
}
|
||||
|
||||
void TraceWindow::updateProfilerState()
|
||||
{
|
||||
bool qmlActive = false;
|
||||
bool v8Active = false;
|
||||
if (m_plugin)
|
||||
qmlActive = m_plugin.data()->isEnabled();
|
||||
if (m_v8plugin)
|
||||
v8Active = m_v8plugin.data()->isEnabled();
|
||||
|
||||
emit profilerStateChanged(qmlActive, v8Active);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
|
||||
Reference in New Issue
Block a user