aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlprofiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-28 10:51:06 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-28 08:59:30 +0000
commit9713146cbc91d7e41af73ac5af1ec09bce028e1b (patch)
treeafe2d5ce1ec7eb17d51d1595c33b21db6a437ef2 /tools/qmlprofiler
parent922ca8c3a839ccbf3407bfe7e449bfceec5ecd23 (diff)
qmlprofiler: Remove V8 profiler client
It's been a long time since the last Qt version with V8. Change-Id: Iae36dd1c5bb6275254c6a64a8e6b843454139e2b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tools/qmlprofiler')
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp38
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.h7
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.cpp48
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.h26
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp142
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.h6
6 files changed, 3 insertions, 264 deletions
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 1eab1a0a8c..93cc49659f 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -84,10 +84,7 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
m_recording(true),
m_interactive(false),
m_qmlProfilerClient(&m_connection),
- m_v8profilerClient(&m_connection),
- m_connectionAttempts(0),
- m_qmlDataReady(false),
- m_v8DataReady(false)
+ m_connectionAttempts(0)
{
m_connectTimer.setInterval(1000);
connect(&m_connectTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
@@ -118,12 +115,7 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
connect(&m_qmlProfilerClient, SIGNAL(inputEvent(QQmlProfilerDefinitions::EventType,qint64)),
&m_profilerData, SLOT(addInputEvent(QQmlProfilerDefinitions::EventType,qint64)));
- connect(&m_qmlProfilerClient, SIGNAL(complete()), this, SLOT(qmlComplete()));
-
- connect(&m_v8profilerClient, SIGNAL(enabledChanged()), this, SLOT(profilerClientEnabled()));
- connect(&m_v8profilerClient, SIGNAL(range(int,QString,QString,int,double,double)),
- &m_profilerData, SLOT(addV8Event(int,QString,QString,int,double,double)));
- connect(&m_v8profilerClient, SIGNAL(complete()), this, SLOT(v8Complete()));
+ connect(&m_qmlProfilerClient, SIGNAL(complete()), &m_profilerData, SLOT(complete()));
connect(&m_profilerData, SIGNAL(error(QString)), this, SLOT(logError(QString)));
connect(&m_profilerData, SIGNAL(dataReady()), this, SLOT(traceFinished()));
@@ -316,7 +308,6 @@ void QmlProfilerApplication::flush()
if (m_recording) {
m_pendingRequest = REQUEST_FLUSH;
m_qmlProfilerClient.sendRecordingStatus(false);
- m_v8profilerClient.sendRecordingStatus(false);
} else {
if (m_profilerData.save(m_interactiveOutputFile)) {
m_profilerData.clear();
@@ -407,7 +398,6 @@ void QmlProfilerApplication::userCommand(const QString &command)
if (cmd == Constants::CMD_RECORD || cmd == Constants::CMD_RECORD2) {
m_pendingRequest = REQUEST_TOGGLE_RECORDING;
m_qmlProfilerClient.sendRecordingStatus(!m_recording);
- m_v8profilerClient.sendRecordingStatus(!m_recording);
} else if (cmd == Constants::CMD_QUIT || cmd == Constants::CMD_QUIT2) {
m_pendingRequest = REQUEST_QUIT;
if (m_recording) {
@@ -570,7 +560,6 @@ void QmlProfilerApplication::traceClientEnabled()
// blocked server is waiting for recording message from both clients
// once the last one is connected, both messages should be sent
m_qmlProfilerClient.sendRecordingStatus(m_recording);
- m_v8profilerClient.sendRecordingStatus(m_recording);
}
void QmlProfilerApplication::profilerClientEnabled()
@@ -580,17 +569,12 @@ void QmlProfilerApplication::profilerClientEnabled()
// blocked server is waiting for recording message from both clients
// once the last one is connected, both messages should be sent
m_qmlProfilerClient.sendRecordingStatus(m_recording);
- m_v8profilerClient.sendRecordingStatus(m_recording);
}
void QmlProfilerApplication::traceFinished()
{
m_recording = false; // only on "Complete" we know that the trace is really finished.
- // after receiving both notifications, reset the flags
- m_qmlDataReady = false;
- m_v8DataReady = false;
-
if (m_pendingRequest == REQUEST_FLUSH) {
flush();
} else if (m_pendingRequest == REQUEST_TOGGLE_RECORDING) {
@@ -626,21 +610,3 @@ void QmlProfilerApplication::logStatus(const QString &status)
QTextStream err(stderr);
err << status << endl;
}
-
-void QmlProfilerApplication::qmlComplete()
-{
- m_qmlDataReady = true;
- if (m_v8profilerClient.state() != QQmlDebugClient::Enabled ||
- m_v8DataReady) {
- m_profilerData.complete();
- }
-}
-
-void QmlProfilerApplication::v8Complete()
-{
- m_v8DataReady = true;
- if (m_qmlProfilerClient.state() != QQmlDebugClient::Enabled ||
- m_qmlDataReady) {
- m_profilerData.complete();
- }
-}
diff --git a/tools/qmlprofiler/qmlprofilerapplication.h b/tools/qmlprofiler/qmlprofilerapplication.h
index f1bf6c3e93..bd3e51aa03 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.h
+++ b/tools/qmlprofiler/qmlprofilerapplication.h
@@ -86,9 +86,6 @@ private slots:
void logError(const QString &error);
void logStatus(const QString &status);
- void qmlComplete();
- void v8Complete();
-
private:
quint64 parseFeatures(const QStringList &featureList, const QString &values, bool exclude);
bool checkOutputFile(PendingRequest pending);
@@ -117,13 +114,9 @@ private:
QQmlDebugConnection m_connection;
QmlProfilerClient m_qmlProfilerClient;
- V8ProfilerClient m_v8profilerClient;
QmlProfilerData m_profilerData;
QTimer m_connectTimer;
uint m_connectionAttempts;
-
- bool m_qmlDataReady;
- bool m_v8DataReady;
};
#endif // QMLPROFILERAPPLICATION_H
diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp
index 72e11eadec..ff723381bc 100644
--- a/tools/qmlprofiler/qmlprofilerclient.cpp
+++ b/tools/qmlprofiler/qmlprofilerclient.cpp
@@ -296,51 +296,3 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
}
}
}
-
-V8ProfilerClient::V8ProfilerClient(QQmlDebugConnection *client)
- : ProfilerClient(QStringLiteral("V8Profiler"), client)
-{
-}
-
-V8ProfilerClient::~V8ProfilerClient()
-{
-}
-
-void V8ProfilerClient::sendRecordingStatus(bool record)
-{
- QByteArray ba;
- QDataStream stream(&ba, QIODevice::WriteOnly);
- QByteArray cmd("V8PROFILER");
- QByteArray option(record ? "start" : "stop");
- QByteArray title("");
-
- stream << cmd << option << title;
- sendMessage(ba);
-}
-
-void V8ProfilerClient::messageReceived(const QByteArray &data)
-{
- QByteArray rwData = data;
- QDataStream stream(&rwData, QIODevice::ReadOnly);
-
- int messageType;
-
- stream >> messageType;
-
- if (messageType == V8Complete) {
- emit complete();
- } else if (messageType == V8Entry) {
- QString filename;
- QString function;
- int lineNumber;
- double totalTime;
- double selfTime;
- int depth;
-
- stream >> filename >> function >> lineNumber >> totalTime >>
- selfTime >> depth;
- emit this->range(depth, function, filename, lineNumber, totalTime,
- selfTime);
- }
-}
-
diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h
index 731ab99973..72423ea676 100644
--- a/tools/qmlprofiler/qmlprofilerclient.h
+++ b/tools/qmlprofiler/qmlprofilerclient.h
@@ -104,30 +104,4 @@ private:
class QmlProfilerClientPrivate *d;
};
-class V8ProfilerClient : public ProfilerClient
-{
- Q_OBJECT
-
-public:
- enum Message {
- V8Entry,
- V8Complete,
-
- V8MaximumMessage
- };
-
- V8ProfilerClient(QQmlDebugConnection *client);
- ~V8ProfilerClient();
-
-public slots:
- void sendRecordingStatus(bool record);
-
-signals:
- void range(int depth, const QString &function, const QString &filename,
- int lineNumber, double totalTime, double selfTime);
-
-protected:
- virtual void messageReceived(const QByteArray &);
-};
-
#endif // QMLPROFILERCLIENT_H
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index ac7b51159f..7e4f174f17 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -127,18 +127,6 @@ Q_DECLARE_TYPEINFO(QmlRangeEventData, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QmlRangeEventStartInstance, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
-struct QV8EventInfo {
- QString displayName;
- QString eventHashStr;
- QString functionName;
- QString fileName;
- int line;
- qint64 totalTime;
- qint64 selfTime;
-
- QHash<QString, qint64> v8children;
-};
-
/////////////////////////////////////////////////////////////////
class QmlProfilerDataPrivate
{
@@ -148,18 +136,12 @@ public:
// data storage
QHash<QString, QmlRangeEventData *> eventDescriptions;
QVector<QmlRangeEventStartInstance> startInstanceList;
- QHash<QString, QV8EventInfo *> v8EventHash;
qint64 traceStartTime;
qint64 traceEndTime;
// internal state while collecting events
qint64 qmlMeasuredTime;
- qint64 v8MeasuredTime;
- QHash<int, QV8EventInfo *> v8parents;
- void clearV8RootEvent();
- QV8EventInfo v8RootEvent;
-
QmlProfilerData::State state;
};
@@ -183,12 +165,6 @@ void QmlProfilerData::clear()
d->eventDescriptions.clear();
d->startInstanceList.clear();
- qDeleteAll(d->v8EventHash);
- d->v8EventHash.clear();
- d->v8parents.clear();
- d->clearV8RootEvent();
- d->v8MeasuredTime = 0;
-
d->traceEndTime = std::numeric_limits<qint64>::min();
d->traceStartTime = std::numeric_limits<qint64>::max();
d->qmlMeasuredTime = 0;
@@ -205,11 +181,6 @@ QString QmlProfilerData::getHashStringForQmlEvent(const QmlEventLocation &locati
QString::number(eventType));
}
-QString QmlProfilerData::getHashStringForV8Event(const QString &displayName, const QString &function)
-{
- return QString(QStringLiteral("%1:%2")).arg(displayName, function);
-}
-
QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type)
{
if (type * sizeof(QString) < sizeof(RANGE_TYPE_STRINGS))
@@ -414,76 +385,6 @@ void QmlProfilerData::addInputEvent(QQmlProfilerDefinitions::EventType type, qin
d->startInstanceList.append(QmlRangeEventStartInstance(time, -1, 0, 0, 0, newEvent));
}
-QString QmlProfilerData::rootEventName()
-{
- return tr("<program>");
-}
-
-QString QmlProfilerData::rootEventDescription()
-{
- return tr("Main Program");
-}
-
-void QmlProfilerDataPrivate::clearV8RootEvent()
-{
- v8RootEvent.displayName = QmlProfilerData::rootEventName();
- v8RootEvent.eventHashStr = QmlProfilerData::rootEventName();
- v8RootEvent.functionName = QmlProfilerData::rootEventDescription();
- v8RootEvent.line = -1;
- v8RootEvent.totalTime = 0;
- v8RootEvent.selfTime = 0;
- v8RootEvent.v8children.clear();
-}
-
-void QmlProfilerData::addV8Event(int depth, const QString &function, const QString &filename,
- int lineNumber, double totalTime, double selfTime)
-{
- QString displayName = filename.mid(filename.lastIndexOf(QLatin1Char('/')) + 1) +
- QLatin1Char(':') + QString::number(lineNumber);
- QString hashStr = getHashStringForV8Event(displayName, function);
-
- setState(AcquiringData);
-
- // time is given in milliseconds, but internally we store it in microseconds
- totalTime *= 1e6;
- selfTime *= 1e6;
-
- // accumulate information
- QV8EventInfo *eventData = d->v8EventHash[hashStr];
- if (!eventData) {
- eventData = new QV8EventInfo;
- eventData->displayName = displayName;
- eventData->eventHashStr = hashStr;
- eventData->fileName = filename;
- eventData->functionName = function;
- eventData->line = lineNumber;
- eventData->totalTime = totalTime;
- eventData->selfTime = selfTime;
- d->v8EventHash[hashStr] = eventData;
- } else {
- eventData->totalTime += totalTime;
- eventData->selfTime += selfTime;
- }
- d->v8parents[depth] = eventData;
-
- QV8EventInfo *parentEvent = 0;
- if (depth == 0) {
- parentEvent = &d->v8RootEvent;
- d->v8MeasuredTime += totalTime;
- }
- if (depth > 0 && d->v8parents.contains(depth-1)) {
- parentEvent = d->v8parents.value(depth-1);
- }
-
- if (parentEvent != 0) {
- if (!parentEvent->v8children.contains(eventData->eventHashStr)) {
- parentEvent->v8children[eventData->eventHashStr] = totalTime;
- } else {
- parentEvent->v8children[eventData->eventHashStr] += totalTime;
- }
- }
-}
-
void QmlProfilerData::computeQmlTime()
{
// compute levels
@@ -567,7 +468,7 @@ void QmlProfilerData::complete()
bool QmlProfilerData::isEmpty() const
{
- return d->startInstanceList.isEmpty() && d->v8EventHash.isEmpty();
+ return d->startInstanceList.isEmpty();
}
bool QmlProfilerData::save(const QString &filename)
@@ -708,38 +609,6 @@ bool QmlProfilerData::save(const QString &filename)
}
stream.writeEndElement(); // profilerDataModel
- stream.writeStartElement(QStringLiteral("v8profile")); // v8 profiler output
- stream.writeAttribute(QStringLiteral("totalTime"), QString::number(d->v8MeasuredTime));
- foreach (QV8EventInfo *v8event, d->v8EventHash.values()) {
- stream.writeStartElement(QStringLiteral("event"));
- stream.writeAttribute(QStringLiteral("index"),QString::number(
- d->v8EventHash.keys().indexOf(v8event->eventHashStr)));
- stream.writeTextElement(QStringLiteral("displayname"), v8event->displayName);
- stream.writeTextElement(QStringLiteral("functionname"), v8event->functionName);
- if (!v8event->fileName.isEmpty()) {
- stream.writeTextElement(QStringLiteral("filename"), v8event->fileName);
- stream.writeTextElement(QStringLiteral("line"), QString::number(v8event->line));
- }
- stream.writeTextElement(QStringLiteral("totalTime"), QString::number(v8event->totalTime));
- stream.writeTextElement(QStringLiteral("selfTime"), QString::number(v8event->selfTime));
- if (!v8event->v8children.isEmpty()) {
- stream.writeStartElement(QStringLiteral("childrenEvents"));
- QStringList childrenIndexes;
- QStringList childrenTimes;
- foreach (const QString &childHash, v8event->v8children.keys()) {
- childrenIndexes << QString::number(v8EventIndex(childHash));
- childrenTimes << QString::number(v8event->v8children[childHash]);
- }
-
- stream.writeAttribute(QStringLiteral("list"), childrenIndexes.join(QString(", ")));
- stream.writeAttribute(QStringLiteral("childrenTimes"),
- childrenTimes.join(QString(", ")));
- stream.writeEndElement();
- }
- stream.writeEndElement();
- }
- stream.writeEndElement(); // v8 profiler output
-
stream.writeEndElement(); // trace
stream.writeEndDocument();
@@ -747,15 +616,6 @@ bool QmlProfilerData::save(const QString &filename)
return true;
}
-int QmlProfilerData::v8EventIndex(const QString &hashStr)
-{
- if (!d->v8EventHash.contains(hashStr)) {
- emit error("Trying to index nonexisting v8 event");
- return -1;
- }
- return d->v8EventHash.keys().indexOf( hashStr );
-}
-
void QmlProfilerData::setState(QmlProfilerData::State state)
{
// It's not an error, we are continuously calling "AcquiringData" for example
diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h
index 91c16c3222..e038fa6884 100644
--- a/tools/qmlprofiler/qmlprofilerdata.h
+++ b/tools/qmlprofiler/qmlprofilerdata.h
@@ -55,11 +55,8 @@ public:
~QmlProfilerData();
static QString getHashStringForQmlEvent(const QmlEventLocation &location, int eventType);
- static QString getHashStringForV8Event(const QString &displayName, const QString &function);
static QString qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type);
static QString qmlMessageAsString(QQmlProfilerDefinitions::Message type);
- static QString rootEventName();
- static QString rootEventDescription();
qint64 traceStartTime() const;
qint64 traceEndTime() const;
@@ -79,8 +76,6 @@ public slots:
QQmlProfilerDefinitions::BindingType bindingType,
qint64 startTime, qint64 duration, const QStringList &data,
const QmlEventLocation &location);
- void addV8Event(int depth, const QString &function, const QString &filename,
- int lineNumber, double totalTime, double selfTime);
void addFrameEvent(qint64 time, int framerate, int animationcount, int threadId);
void addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time,
qint64 numericData1, qint64 numericData2, qint64 numericData3,
@@ -95,7 +90,6 @@ public slots:
private:
void sortStartTimes();
- int v8EventIndex(const QString &hashStr);
void computeQmlTime();
void setState(QmlProfilerData::State state);