Commit a5378092 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Apply some code cosmetics



Change-Id: I772713aec3a6c25136174b39b853a9ef3ee42a0b
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent 54b1106f
......@@ -25,8 +25,8 @@
#include "flamegraphmodel.h"
#include <qmlprofiler/qmlprofilermodelmanager.h>
#include <qmlprofiler/qmlprofilerdatamodel.h>
#include "qmlprofilermodelmanager.h"
#include "qmlprofilerdatamodel.h"
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
......
......@@ -25,9 +25,8 @@
#include "flamegraphview.h"
#include "flamegraph.h"
#include <qmlprofiler/qmlprofilerconstants.h>
#include <qmlprofiler/qmlprofilertool.h>
#include "qmlprofilerconstants.h"
#include "qmlprofilertool.h"
#include <QQmlContext>
#include <QVBoxLayout>
......
......@@ -37,9 +37,10 @@
#include <QTcpServer>
#include <QTemporaryFile>
using namespace QmlProfiler;
using namespace ProjectExplorer;
namespace QmlProfiler {
QString LocalQmlProfilerRunner::findFreeSocket()
{
QTemporaryFile file;
......@@ -140,3 +141,5 @@ void LocalQmlProfilerRunner::stop()
if (m_launcher.isRunning())
m_launcher.stop();
}
} // namespace QmlProfiler
......@@ -35,16 +35,16 @@ struct QmlEventType {
const QmlEventLocation &location = QmlEventLocation(),
Message message = MaximumMessage, RangeType rangeType = MaximumRangeType,
int detailType = -1, const QString &data = QString()) :
displayName(displayName), location(location), message(message), rangeType(rangeType),
detailType(detailType), data(data)
displayName(displayName), data(data), location(location), message(message),
rangeType(rangeType), detailType(detailType)
{}
QString displayName;
QString data;
QmlEventLocation location;
Message message;
RangeType rangeType;
int detailType; // can be EventType, BindingType, PixmapEventType or SceneGraphFrameType
QString data;
};
} // namespace QmlProfiler
......@@ -26,16 +26,16 @@
#include "qmlprofileranimationsmodel.h"
#include "qmlprofilermodelmanager.h"
#include "qmlprofilerdatamodel.h"
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QCoreApplication>
#include <QVector>
#include <QHash>
#include <QUrl>
#include <QString>
#include <QStack>
#include <QDebug>
namespace QmlProfiler {
namespace Internal {
......@@ -205,5 +205,5 @@ QVariantMap QmlProfilerAnimationsModel::details(int index) const
return result;
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -77,5 +77,5 @@ private:
int rowFromThreadId(int threadId) const;
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -26,7 +26,6 @@
#include "qmlprofilerattachdialog.h"
#include <projectexplorer/kitchooser.h>
#include <coreplugin/id.h>
#include <QSpinBox>
......
......@@ -380,5 +380,5 @@ void BindingLoopsRenderPassState::updateIndexes(int from, int to)
m_indexTo = to;
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -25,10 +25,12 @@
#pragma once
#include "qmlprofilerrangemodel.h"
#include "timeline/timelineabstractrenderer.h"
#include "timeline/timelinerenderpass.h"
#include "timeline/timelinerenderstate.h"
#include "qmlprofilerrangemodel.h"
#include <QSGMaterial>
namespace QmlProfiler {
......@@ -46,5 +48,5 @@ protected:
QmlProfilerBindingLoopsRenderPass();
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -30,11 +30,11 @@
#include "qmlprofilermodelmanager.h"
#include <utils/qtcassert.h>
#include <QPointer>
#include <QTimer>
#include <QMessageBox>
using namespace QmlDebug;
using namespace Core;
namespace QmlProfiler {
......@@ -45,7 +45,7 @@ class QmlProfilerClientManager::QmlProfilerClientManagerPrivate
public:
QmlProfilerStateManager *profilerState;
QmlDebugConnection *connection;
QmlDebug::QmlDebugConnection *connection;
QPointer<QmlProfilerTraceClient> qmlclientplugin;
QTimer connectionTimer;
......@@ -169,7 +169,7 @@ void QmlProfilerClientManager::connectLocalClient(const QString &file)
void QmlProfilerClientManager::createConnection()
{
d->connection = new QmlDebugConnection;
d->connection = new QmlDebug::QmlDebugConnection;
QTC_ASSERT(d->profilerState, return);
disconnectClientSignals();
......@@ -180,13 +180,13 @@ void QmlProfilerClientManager::createConnection()
d->profilerState->requestedFeatures());
d->qmlclientplugin->setFlushInterval(d->flushInterval);
connectClientSignals();
connect(d->connection, &QmlDebugConnection::connected,
connect(d->connection, &QmlDebug::QmlDebugConnection::connected,
this, &QmlProfilerClientManager::qmlDebugConnectionOpened);
connect(d->connection, &QmlDebugConnection::disconnected,
connect(d->connection, &QmlDebug::QmlDebugConnection::disconnected,
this, &QmlProfilerClientManager::qmlDebugConnectionClosed);
connect(d->connection, &QmlDebugConnection::socketError,
connect(d->connection, &QmlDebug::QmlDebugConnection::socketError,
this, &QmlProfilerClientManager::qmlDebugConnectionError);
connect(d->connection, &QmlDebugConnection::socketStateChanged,
connect(d->connection, &QmlDebug::QmlDebugConnection::socketStateChanged,
this, &QmlProfilerClientManager::qmlDebugConnectionStateChanged);
}
......@@ -313,7 +313,7 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed()
void QmlProfilerClientManager::qmlDebugConnectionError(QAbstractSocket::SocketError error)
{
logState(QmlDebugConnection::socketErrorToString(error));
logState(QmlDebug::QmlDebugConnection::socketErrorToString(error));
if (d->connection->isConnected()) {
disconnectClient();
emit connectionClosed();
......@@ -324,7 +324,7 @@ void QmlProfilerClientManager::qmlDebugConnectionError(QAbstractSocket::SocketEr
void QmlProfilerClientManager::qmlDebugConnectionStateChanged(QAbstractSocket::SocketState state)
{
logState(QmlDebugConnection::socketStateToString(state));
logState(QmlDebug::QmlDebugConnection::socketStateToString(state));
}
void QmlProfilerClientManager::logState(const QString &msg)
......
......@@ -95,5 +95,5 @@ private:
void stopClientsRecording();
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -38,6 +38,8 @@ const char AGGREGATE_TRACES[] = "Analyzer.QmlProfiler.AggregateTraces";
const char SETTINGS[] = "Analyzer.QmlProfiler.Settings";
const char ANALYZER[] = "Analyzer";
const int QML_MIN_LEVEL = 1; // Set to 0 to remove the empty line between models in the timeline
const char TraceFileExtension[] = ".qtd";
const char QmlProfilerPerspectiveId[] = "QmlProfiler.Perspective";
......
......@@ -291,4 +291,4 @@ void QmlProfilerDataModel::detailsDone()
d->modelManager->processingDone();
}
}
} // namespace QmlProfiler
......@@ -42,4 +42,4 @@ struct QMLPROFILER_EXPORT QmlEventLocation
int column;
};
}
} // namespace QmlProfiler
......@@ -53,4 +53,4 @@ public slots:
virtual void onVisibleFeaturesChanged(quint64 features) = 0;
};
}
} // namespace QmlProfiler
......@@ -169,7 +169,6 @@ inline ProfileFeature featureFromRangeType(RangeType range)
}
namespace Constants {
const int QML_MIN_LEVEL = 1; // Set to 0 to remove the empty line between models in the timeline
// Shorthand for all QML and JS range features.
const quint64 QML_JS_RANGE_FEATURES = (1 << ProfileCompiling) |
......@@ -177,6 +176,6 @@ const quint64 QML_JS_RANGE_FEATURES = (1 << ProfileCompiling) |
(1 << ProfileBinding) |
(1 << ProfileHandlingSignal) |
(1 << ProfileJavaScript);
}
} // namespace Constants
} // namespace QmlProfiler
......@@ -129,18 +129,14 @@ void QmlProfilerTraceTime::increaseEndTime(qint64 time)
class QmlProfilerModelManager::QmlProfilerModelManagerPrivate
{
public:
QmlProfilerModelManagerPrivate(QmlProfilerModelManager *qq) : q(qq) {}
~QmlProfilerModelManagerPrivate() {}
QmlProfilerModelManager *q;
QmlProfilerDataModel *model;
QmlProfilerNotesModel *notesModel;
QmlProfilerModelManager::State state;
QmlProfilerTraceTime *traceTime;
QVector <double> partialCounts;
QVector <int> partialCountWeights;
QVector<double> partialCounts;
QVector<int> partialCountWeights;
quint64 availableFeatures;
quint64 visibleFeatures;
quint64 recordedFeatures;
......@@ -152,7 +148,7 @@ public:
QmlProfilerModelManager::QmlProfilerModelManager(Utils::FileInProjectFinder *finder, QObject *parent) :
QObject(parent), d(new QmlProfilerModelManagerPrivate(this))
QObject(parent), d(new QmlProfilerModelManagerPrivate)
{
d->totalWeight = 0;
d->previousProgress = 0;
......@@ -293,12 +289,12 @@ void QmlProfilerModelManager::addQmlEvent(Message message, RangeType rangeType,
ndata2, ndata3, ndata4, ndata5);
}
void QmlProfilerModelManager::addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text,
const QmlEventLocation &location)
void QmlProfilerModelManager::addDebugMessage(qint64 timestamp, QtMsgType messageType,
const QString &text, const QmlEventLocation &location)
{
if (state() == AcquiringData)
d->model->addEvent(DebugMessage, MaximumRangeType, type, timestamp, 0, text, location, 0, 0,
0, 0, 0);
d->model->addEvent(DebugMessage, MaximumRangeType, messageType, timestamp, 0, text,
location, 0, 0, 0, 0, 0);
}
void QmlProfilerModelManager::acquiringDone()
......@@ -443,7 +439,7 @@ void QmlProfilerModelManager::clear()
setState(Empty);
}
void QmlProfilerModelManager::prepareForWriting()
void QmlProfilerModelManager::startAcquiring()
{
setState(AcquiringData);
}
......
......@@ -116,7 +116,6 @@ signals:
void loadFinished();
void saveFinished();
void requestDetailsForLocation(int eventType, const QmlEventLocation &location);
void availableFeaturesChanged(quint64 features);
void visibleFeaturesChanged(quint64 features);
void recordedFeaturesChanged(quint64 features);
......@@ -124,11 +123,11 @@ signals:
public slots:
void clear();
void prepareForWriting();
void startAcquiring();
void addQmlEvent(Message message, RangeType rangeType, int bindingType, qint64 startTime,
qint64 length, const QString &data, const QmlEventLocation &location,
qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5);
void addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text,
void addDebugMessage(qint64 timestamp, QtMsgType type, const QString &text,
const QmlEventLocation &location);
void save(const QString &filename);
......@@ -142,4 +141,4 @@ private:
QmlProfilerModelManagerPrivate *d;
};
}
} // namespace QmlProfiler
......@@ -27,6 +27,7 @@
#include "qmlprofilermodelmanager.h"
#include "qmlprofilerdatamodel.h"
#include "qmlprofilerbindingloopsrenderpass.h"
#include "timeline/timelinenotesrenderpass.h"
#include "timeline/timelineitemsrenderpass.h"
#include "timeline/timelineselectionrenderpass.h"
......@@ -38,12 +39,9 @@
#include <QString>
#include <QStack>
#include <QDebug>
namespace QmlProfiler {
namespace Internal {
QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range,
QObject *parent) :
QmlProfilerTimelineModel(manager, MaximumMessage, range, featureFromRangeType(range), parent)
......@@ -272,5 +270,5 @@ QList<const Timeline::TimelineRenderPass *> QmlProfilerRangeModel::supportedRend
}
}
}
} // namespace Internal
} // namespaec QmlProfiler
......@@ -29,6 +29,7 @@
#include "qmlprofilerdatamodel.h"
#include "qmlprofilereventtypes.h"
#include "qmlprofilereventlocation.h"
#include "qmlprofilerconstants.h"
#include <QVariantList>
#include <QColor>
......@@ -86,5 +87,5 @@ private:
QVector<int> m_expandedRowTypes;
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -24,7 +24,6 @@
****************************************************************************/
#include "qmlprofilerruncontrol.h"
#include "localqmlprofilerrunner.h"
#include "qmlprofilertool.h"
......
......@@ -176,4 +176,4 @@ void QmlProfilerStateManager::setRecordedFeatures(quint64 features)
}
}
}
} // namespace QmlProfiler
......@@ -70,4 +70,4 @@ private:
QmlProfilerStateManagerPrivate *d;
};
}
} // namespace QmlProfiler
......@@ -227,5 +227,5 @@ void QmlProfilerStateWidget::updateDisplay()
setVisible(false);
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -25,11 +25,11 @@
#pragma once
#include <QWidget>
#include "qmlprofilerstatemanager.h"
#include "qmlprofilermodelmanager.h"
#include <QWidget>
namespace QmlProfiler {
namespace Internal {
......@@ -54,5 +54,5 @@ private:
QmlProfilerStateWidgetPrivate *d;
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -32,12 +32,9 @@
#include <QVector>
#include <QHash>
#include <QUrl>
#include <QString>
#include <QStack>
#include <QElapsedTimer>
#include <QDebug>
#include <QSet>
namespace QmlProfiler {
......
......@@ -29,6 +29,7 @@
#include "qmlprofilernotesmodel.h"
#include "qmlprofilereventtypes.h"
#include "qmlprofilereventlocation.h"
#include "qmlprofilerconstants.h"
#include <QHash>
#include <QVector>
......
......@@ -24,28 +24,23 @@
****************************************************************************/
#include "qmlprofilerstatisticsview.h"
#include "qmlprofilerviewmanager.h"
#include "qmlprofilertool.h"
#include <coreplugin/minisplitter.h>
#include <utils/qtcassert.h>
#include <QUrl>
#include <QHash>
#include <QStandardItem>
#include <QHeaderView>
#include <QApplication>
#include <QClipboard>
#include <QContextMenuEvent>
#include <QDebug>
#include <coreplugin/minisplitter.h>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "qmlprofilerviewmanager.h"
#include "qmlprofilertool.h"
#include <QMenu>
#include <utils/qtcassert.h>
#include <functional>
namespace QmlProfiler {
......
......@@ -123,7 +123,6 @@ public:
void setShowExtendedStatistics(bool);
bool showExtendedStatistics() const;
signals:
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
void typeSelected(int typeIndex);
......
......@@ -875,7 +875,7 @@ void QmlProfilerTool::serverRecordingChanged()
if (!d->m_profilerConnections->aggregateTraces() ||
d->m_profilerModelManager->state() == QmlProfilerModelManager::Done)
clearData();
d->m_profilerModelManager->prepareForWriting();
d->m_profilerModelManager->startAcquiring();
} else {
setRecording(false);
......@@ -908,5 +908,5 @@ void QmlProfilerTool::toggleVisibleFeature(QAction *action)
d->m_profilerModelManager->visibleFeatures() & (~(1ULL << feature)));
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -64,10 +64,6 @@ public:
quint32 flushInterval;
};
} // namespace QmlProfiler
using namespace QmlProfiler;
void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
{
QmlDebug::QPacket stream(q->connection()->currentDataStreamVersion());
......@@ -150,7 +146,7 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
const QmlDebug::QDebugContextInfo &context)
{
d->updateFeatures(ProfileDebugMessages);
emit debugMessage(type, context.timestamp, text,
emit debugMessage(context.timestamp, type, text,
QmlEventLocation(context.file, context.line, 1));
});
} else {
......@@ -399,3 +395,5 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
break;
}
}
} // namespace QmlProfiler
......@@ -41,9 +41,6 @@ class QmlProfilerTraceClient : public QmlDebug::QmlDebugClient
Q_OBJECT
Q_PROPERTY(bool recording READ isRecording WRITE setRecording NOTIFY recordingChanged)
// don't hide by signal
using QObject::event;
public:
QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client, quint64 features);
~QmlProfilerTraceClient();
......@@ -60,13 +57,16 @@ public slots:
signals:
void complete(qint64 maximumTime);
void traceFinished(qint64 time, const QList<int> &engineIds);
void traceStarted(qint64 time, const QList<int> &engineIds);
void traceFinished(qint64 timestamp, const QList<int> &engineIds);
void traceStarted(qint64 timestamp, const QList<int> &engineIds);
void rangedEvent(Message, RangeType, int detailType, qint64 startTime, qint64 length,
const QString &data, const QmlEventLocation &location, qint64 param1,
qint64 param2, qint64 param3, qint64 param4, qint64 param5);
void debugMessage(QtMsgType type, qint64 timestamp, const QString &text,
void debugMessage(qint64 timestamp, QtMsgType type, const QString &text,
const QmlEventLocation &location);
void recordingChanged(bool arg);
void recordedFeaturesChanged(quint64 features);
void newEngine(int engineId);
......
......@@ -25,7 +25,6 @@
#include "qmlprofilertracefile.h"
#include <utils/qtcassert.h>
#include <QIODevice>
......@@ -657,12 +656,12 @@ void QmlProfilerFileWriter::save(QIODevice *device)
if (isCanceled())
return;
const QmlNote &notes = m_notes[noteIndex];
const QmlNote &note = m_notes[noteIndex];
stream.writeStartElement(_("note"));
stream.writeAttribute(_("startTime"), QString::number(notes.startTime));