diff options
| author | Christiaan Janssen <christiaan.janssen@nokia.com> | 2011-09-27 14:38:22 +0200 |
|---|---|---|
| committer | Christiaan Janssen <christiaan.janssen@nokia.com> | 2011-10-07 17:19:50 +0200 |
| commit | a26259997c966b4fcc8013589ebbfdc313323520 (patch) | |
| tree | 24b3b18b565302ad7eace7c5f4c3b11275cdd822 /src/tools/qmlprofilertool | |
| parent | 9057d87805abfa5dc412f53c2a9a12704ff7aab9 (diff) | |
| download | qt-creator-a26259997c966b4fcc8013589ebbfdc313323520.tar.gz | |
QmlProfiler: V8 profiling
Change-Id: I926c5821d31453064f5dbed2b5a10f6195761f42
Reviewed-on: http://codereview.qt-project.org/5892
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Diffstat (limited to 'src/tools/qmlprofilertool')
| -rw-r--r-- | src/tools/qmlprofilertool/qmlprofilerapplication.cpp | 27 | ||||
| -rw-r--r-- | src/tools/qmlprofilertool/qmlprofilerapplication.h | 11 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/tools/qmlprofilertool/qmlprofilerapplication.cpp b/src/tools/qmlprofilertool/qmlprofilerapplication.cpp index 305663a649..457b85028a 100644 --- a/src/tools/qmlprofilertool/qmlprofilerapplication.cpp +++ b/src/tools/qmlprofilertool/qmlprofilerapplication.cpp @@ -84,6 +84,7 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : m_verbose(false), m_quitAfterSave(false), m_traceClient(&m_connection), + m_v8profilerClient(&m_connection), m_connectionAttempts(0) { m_connectTimer.setInterval(1000); @@ -96,11 +97,15 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : connect(&m_traceClient, SIGNAL(enabled()), this, SLOT(traceClientEnabled())); connect(&m_traceClient, SIGNAL(recordingChanged(bool)), this, SLOT(recordingChanged())); connect(&m_traceClient, SIGNAL(range(int,qint64,qint64,QStringList,QString,int)), &m_eventList, SLOT(addRangedEvent(int,qint64,qint64,QStringList,QString,int))); - connect(&m_traceClient, SIGNAL(complete()), &m_eventList, SLOT(complete())); + connect(&m_traceClient, SIGNAL(complete()), this, SLOT(qmlComplete())); + + connect(&m_v8profilerClient, SIGNAL(v8range(int,QString,QString,int,double,double)), &m_eventList, SLOT(addV8Event(int,QString,QString,int,double,double))); + connect(&m_v8profilerClient, SIGNAL(v8complete()), this, SLOT(v8complete())); connect(&m_eventList, SIGNAL(error(QString)), this, SLOT(logError(QString))); connect(&m_eventList, SIGNAL(dataReady()), this, SLOT(traceFinished())); connect(&m_eventList, SIGNAL(parsingStatusChanged()), this, SLOT(parsingStatusChanged())); + connect(this, SIGNAL(done()), &m_eventList, SLOT(complete())); } QmlProfilerApplication::~QmlProfilerApplication() @@ -140,6 +145,7 @@ bool QmlProfilerApplication::parseArguments() } } else if (arg == QLatin1String("-fromStart")) { m_traceClient.setRecording(true); + m_v8profilerClient.setRecording(true); } else if (arg == QLatin1String("-help") || arg == QLatin1String("-h") || arg == QLatin1String("/h") || arg == QLatin1String("/?")) { return false; } else if (arg == QLatin1String("-verbose") || arg == QLatin1String("-v")) { @@ -212,11 +218,16 @@ void QmlProfilerApplication::userCommand(const QString &command) } else if (cmd == Constants::CMD_RECORD || cmd == Constants::CMD_RECORD2) { m_traceClient.setRecording(!m_traceClient.isRecording()); + m_qmlDataReady = false; + m_v8DataReady = false; } else if (cmd == Constants::CMD_QUIT || cmd == Constants::CMD_QUIT2) { if (m_traceClient.isRecording()) { m_quitAfterSave = true; + m_qmlDataReady = false; + m_v8DataReady = false; m_traceClient.setRecording(false); + m_v8profilerClient.setRecording(false); } else { quit(); } @@ -383,3 +394,17 @@ void QmlProfilerApplication::logStatus(const QString &status) QTextStream err(stderr); err << status << endl; } + +void QmlProfilerApplication::qmlComplete() +{ + m_qmlDataReady = true; + if (m_v8profilerClient.status() != QDeclarativeDebugClient::Enabled || m_v8DataReady) + emit done(); +} + +void QmlProfilerApplication::v8Complete() +{ + m_v8DataReady = true; + if (m_traceClient.status() != QDeclarativeDebugClient::Enabled || m_qmlDataReady) + emit done(); +} diff --git a/src/tools/qmlprofilertool/qmlprofilerapplication.h b/src/tools/qmlprofilertool/qmlprofilerapplication.h index 5bc0ff0a1e..a33052d42f 100644 --- a/src/tools/qmlprofilertool/qmlprofilerapplication.h +++ b/src/tools/qmlprofilertool/qmlprofilerapplication.h @@ -40,6 +40,7 @@ #include <qdeclarativedebugclient.h> #include <qmlprofilertraceclient.h> #include <qmlprofilereventlist.h> +#include <qv8profilerclient.h> QT_FORWARD_DECLARE_CLASS(QProcess) @@ -54,6 +55,9 @@ public: void printUsage(); int exec(); +signals: + void done(); + public slots: void userCommand(const QString &command); @@ -75,6 +79,9 @@ private slots: void logError(const QString &error); void logStatus(const QString &status); + void qmlComplete(); + void v8Complete(); + private: void printCommands(); QString traceFileName() const; @@ -97,9 +104,13 @@ private: QmlJsDebugClient::QDeclarativeDebugConnection m_connection; QmlJsDebugClient::QmlProfilerTraceClient m_traceClient; + QmlJsDebugClient::QV8ProfilerClient m_v8profilerClient; QmlJsDebugClient::QmlProfilerEventList m_eventList; QTimer m_connectTimer; uint m_connectionAttempts; + + bool m_qmlDataReady; + bool m_v8DataReady; }; #endif // QMLPROFILERAPPLICATION_H |
