forked from qt-creator/qt-creator
QmlProfiler: refactor postprocess step in internal statistics
Change-Id: Id6ea03161ccad92a27a664e84f56b2a49400be91 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -167,7 +167,6 @@ public:
|
||||
|
||||
// file to load
|
||||
QString m_filename;
|
||||
ParsingStatus m_parsingStatus;
|
||||
};
|
||||
|
||||
|
||||
@@ -177,7 +176,6 @@ public:
|
||||
QmlProfilerEventList::QmlProfilerEventList(QObject *parent) :
|
||||
QObject(parent), d(new QmlProfilerEventListPrivate(this))
|
||||
{
|
||||
d->m_parsingStatus = DoneStatus;
|
||||
setObjectName("QmlProfilerEventStatistics");
|
||||
|
||||
d->m_traceEndTime = 0;
|
||||
@@ -243,11 +241,11 @@ const QV8EventDescriptions& QmlProfilerEventList::getV8Events() const
|
||||
void QmlProfilerEventList::addRangedEvent(int type, qint64 startTime, qint64 length,
|
||||
const QStringList &data, const QString &fileName, int line)
|
||||
{
|
||||
setParsingStatus(GettingDataStatus);
|
||||
|
||||
const QChar colon = QLatin1Char(':');
|
||||
QString displayName, location, details;
|
||||
|
||||
emit processingData();
|
||||
|
||||
if (fileName.isEmpty()) {
|
||||
displayName = tr("<bytecode>");
|
||||
location = QString("--:%1:%2").arg(QString::number(type), data.join(" "));
|
||||
@@ -468,9 +466,6 @@ void QmlProfilerEventList::compileStatistics()
|
||||
if (!d->m_typeCounts[typeNumber]->eventIds.contains(eventStartData.description->eventId))
|
||||
d->m_typeCounts[typeNumber]->eventIds << eventStartData.description->eventId;
|
||||
}
|
||||
|
||||
// continue postprocess
|
||||
postProcess();
|
||||
}
|
||||
|
||||
void QmlProfilerEventList::sortStartTimes()
|
||||
@@ -513,9 +508,6 @@ void QmlProfilerEventList::sortStartTimes()
|
||||
// link back the endTimes
|
||||
for (int i = 0; i < d->m_startTimeSortedList.length(); i++)
|
||||
d->m_endTimeSortedList[d->m_startTimeSortedList[i].endTimeIndex].startTimeIndex = i;
|
||||
|
||||
// continue postprocess
|
||||
postProcess();
|
||||
}
|
||||
|
||||
void QmlProfilerEventList::sortEndTimes()
|
||||
@@ -562,9 +554,6 @@ void QmlProfilerEventList::sortEndTimes()
|
||||
// link back the startTimes
|
||||
for (int i = 0; i < d->m_endTimeSortedList.length(); i++)
|
||||
d->m_startTimeSortedList[d->m_endTimeSortedList[i].startTimeIndex].endTimeIndex = i;
|
||||
|
||||
// continue postprocess
|
||||
postProcess();
|
||||
}
|
||||
|
||||
void QmlProfilerEventList::computeNestingLevels()
|
||||
@@ -632,50 +621,12 @@ void QmlProfilerEventList::computeNestingDepth()
|
||||
|
||||
void QmlProfilerEventList::postProcess()
|
||||
{
|
||||
// Todo: collapse all this
|
||||
switch (d->m_parsingStatus) {
|
||||
case GettingDataStatus: {
|
||||
setParsingStatus(SortingListsStatus);
|
||||
QTimer::singleShot(50, this, SLOT(sortStartTimes()));
|
||||
break;
|
||||
}
|
||||
case SortingEndsStatus: {
|
||||
setParsingStatus(SortingListsStatus);
|
||||
QTimer::singleShot(50, this, SLOT(sortEndTimes()));
|
||||
break;
|
||||
}
|
||||
case SortingListsStatus: {
|
||||
setParsingStatus(ComputingLevelsStatus);
|
||||
QTimer::singleShot(50, this, SLOT(computeLevels()));
|
||||
break;
|
||||
}
|
||||
case ComputingLevelsStatus: {
|
||||
setParsingStatus(CompilingStatisticsStatus);
|
||||
QTimer::singleShot(50, this, SLOT(compileStatistics()));
|
||||
break;
|
||||
}
|
||||
case CompilingStatisticsStatus: {
|
||||
linkEndsToStarts();
|
||||
setParsingStatus(DoneStatus);
|
||||
emit dataReady();
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QmlProfilerEventList::setParsingStatus(ParsingStatus ps)
|
||||
{
|
||||
if (d->m_parsingStatus != ps) {
|
||||
d->m_parsingStatus = ps;
|
||||
emit parsingStatusChanged();
|
||||
}
|
||||
}
|
||||
|
||||
ParsingStatus QmlProfilerEventList::getParsingStatus() const
|
||||
{
|
||||
return d->m_parsingStatus;
|
||||
sortStartTimes();
|
||||
sortEndTimes();
|
||||
computeLevels();
|
||||
compileStatistics();
|
||||
linkEndsToStarts();
|
||||
emit dataReady();
|
||||
}
|
||||
|
||||
void QmlProfilerEventList::linkEndsToStarts()
|
||||
@@ -688,8 +639,6 @@ void QmlProfilerEventList::computeLevels()
|
||||
{
|
||||
computeNestingLevels();
|
||||
computeNestingDepth();
|
||||
// continue postprocess
|
||||
postProcess();
|
||||
}
|
||||
|
||||
// get list of events between A and B:
|
||||
@@ -930,7 +879,7 @@ void QmlProfilerEventList::load()
|
||||
return;
|
||||
}
|
||||
|
||||
setParsingStatus(GettingDataStatus);
|
||||
emit processingData();
|
||||
|
||||
// erase current
|
||||
clear();
|
||||
@@ -1164,8 +1113,6 @@ void QmlProfilerEventList::load()
|
||||
|
||||
emit countChanged();
|
||||
|
||||
setParsingStatus(SortingEndsStatus);
|
||||
|
||||
descriptionBuffer.clear();
|
||||
|
||||
d->collectV8Statistics();
|
||||
|
||||
@@ -81,15 +81,6 @@ typedef QHash<QString, QmlEventData *> QmlEventHash;
|
||||
typedef QList<QmlEventData *> QmlEventDescriptions;
|
||||
typedef QList<QV8EventData *> QV8EventDescriptions;
|
||||
|
||||
enum ParsingStatus {
|
||||
GettingDataStatus = 0,
|
||||
SortingListsStatus = 1,
|
||||
SortingEndsStatus = 2,
|
||||
ComputingLevelsStatus = 3,
|
||||
CompilingStatisticsStatus = 4,
|
||||
DoneStatus = 5
|
||||
};
|
||||
|
||||
class QMLJSDEBUGCLIENT_EXPORT QmlProfilerEventList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -110,8 +101,6 @@ public:
|
||||
Q_INVOKABLE qint64 lastTimeMark() const;
|
||||
|
||||
Q_INVOKABLE int count() const;
|
||||
void setParsingStatus(ParsingStatus ps);
|
||||
Q_INVOKABLE ParsingStatus getParsingStatus() const;
|
||||
|
||||
// data access
|
||||
Q_INVOKABLE qint64 getStartTime(int index) const;
|
||||
@@ -139,9 +128,9 @@ public:
|
||||
signals:
|
||||
void dataReady();
|
||||
void countChanged();
|
||||
void parsingStatusChanged();
|
||||
void error(const QString &error);
|
||||
void dataClear();
|
||||
void processingData();
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
@@ -101,7 +101,7 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
onParsingStatusChanged: {
|
||||
onProcessingData: {
|
||||
root.dataAvailable = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
@@ -339,32 +338,6 @@ void QmlProfilerApplication::traceFinished()
|
||||
quit();
|
||||
}
|
||||
|
||||
void QmlProfilerApplication::parsingStatusChanged()
|
||||
{
|
||||
if (m_verbose) {
|
||||
switch (m_eventList.getParsingStatus()) {
|
||||
case GettingDataStatus:
|
||||
logStatus("Parsing - Getting data ...");
|
||||
break;
|
||||
case SortingListsStatus:
|
||||
logStatus("Parsing - Sorting ...");
|
||||
break;
|
||||
case SortingEndsStatus:
|
||||
logStatus("Parsing - Sorting done");
|
||||
break;
|
||||
case ComputingLevelsStatus:
|
||||
logStatus("Parsing - Computing levels ...");
|
||||
break;
|
||||
case CompilingStatisticsStatus:
|
||||
logStatus("Parsing - Computing statistics ...");
|
||||
break;
|
||||
case DoneStatus:
|
||||
logStatus("Parsing - Done.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerApplication::recordingChanged()
|
||||
{
|
||||
QTextStream err(stderr);
|
||||
|
||||
@@ -72,7 +72,6 @@ private slots:
|
||||
|
||||
void traceClientEnabled();
|
||||
void traceFinished();
|
||||
void parsingStatusChanged();
|
||||
void recordingChanged();
|
||||
|
||||
void print(const QString &line);
|
||||
|
||||
Reference in New Issue
Block a user