forked from qt-creator/qt-creator
QmlProfiler: Track requested, recorded, and displayed features
This way we can have a central filter menu to hide and show features in any connected views. Change-Id: I8142da0062a23f8166555016de6c7cb38060f725 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -41,12 +41,14 @@ public:
|
|||||||
, inProgressRanges(0)
|
, inProgressRanges(0)
|
||||||
, maximumTime(0)
|
, maximumTime(0)
|
||||||
, recording(false)
|
, recording(false)
|
||||||
, features(0)
|
, requestedFeatures(0)
|
||||||
|
, recordedFeatures(0)
|
||||||
{
|
{
|
||||||
::memset(rangeCount, 0, MaximumRangeType * sizeof(int));
|
::memset(rangeCount, 0, MaximumRangeType * sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendRecordingStatus(int engineId);
|
void sendRecordingStatus(int engineId);
|
||||||
|
bool updateFeatures(QmlDebug::ProfileFeature feature);
|
||||||
|
|
||||||
QmlProfilerTraceClient *q;
|
QmlProfilerTraceClient *q;
|
||||||
QmlEngineControlClient engineControl;
|
QmlEngineControlClient engineControl;
|
||||||
@@ -58,7 +60,8 @@ public:
|
|||||||
int rangeCount[MaximumRangeType];
|
int rangeCount[MaximumRangeType];
|
||||||
qint64 maximumTime;
|
qint64 maximumTime;
|
||||||
bool recording;
|
bool recording;
|
||||||
quint64 features;
|
quint64 requestedFeatures;
|
||||||
|
quint64 recordedFeatures;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDebug
|
} // namespace QmlDebug
|
||||||
@@ -73,7 +76,7 @@ void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
|
|||||||
QDataStream stream(&ba, QIODevice::WriteOnly);
|
QDataStream stream(&ba, QIODevice::WriteOnly);
|
||||||
stream << recording << engineId; // engineId -1 is OK. It means "all of them"
|
stream << recording << engineId; // engineId -1 is OK. It means "all of them"
|
||||||
if (recording)
|
if (recording)
|
||||||
stream << features;
|
stream << requestedFeatures;
|
||||||
q->sendMessage(ba);
|
q->sendMessage(ba);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +84,7 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint
|
|||||||
: QmlDebugClient(QLatin1String("CanvasFrameRate"), client)
|
: QmlDebugClient(QLatin1String("CanvasFrameRate"), client)
|
||||||
, d(new QmlProfilerTraceClientPrivate(this, client))
|
, d(new QmlProfilerTraceClientPrivate(this, client))
|
||||||
{
|
{
|
||||||
d->features = features;
|
d->requestedFeatures = features;
|
||||||
connect(&d->engineControl, SIGNAL(engineAboutToBeAdded(int,QString)),
|
connect(&d->engineControl, SIGNAL(engineAboutToBeAdded(int,QString)),
|
||||||
this, SLOT(sendRecordingStatus(int)));
|
this, SLOT(sendRecordingStatus(int)));
|
||||||
}
|
}
|
||||||
@@ -104,6 +107,10 @@ void QmlProfilerTraceClient::clearData()
|
|||||||
d->rangeStartTimes[eventType].clear();
|
d->rangeStartTimes[eventType].clear();
|
||||||
}
|
}
|
||||||
d->bindingTypes.clear();
|
d->bindingTypes.clear();
|
||||||
|
if (d->recordedFeatures != 0) {
|
||||||
|
d->recordedFeatures = 0;
|
||||||
|
emit recordedFeaturesChanged(0);
|
||||||
|
}
|
||||||
emit cleared();
|
emit cleared();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,9 +142,14 @@ void QmlProfilerTraceClient::setRecording(bool v)
|
|||||||
emit recordingChanged(v);
|
emit recordingChanged(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTraceClient::setFeatures(quint64 features)
|
quint64 QmlProfilerTraceClient::recordedFeatures() const
|
||||||
{
|
{
|
||||||
d->features = features;
|
return d->recordedFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
|
||||||
|
{
|
||||||
|
d->requestedFeatures = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTraceClient::setRecordingFromServer(bool v)
|
void QmlProfilerTraceClient::setRecordingFromServer(bool v)
|
||||||
@@ -148,6 +160,18 @@ void QmlProfilerTraceClient::setRecordingFromServer(bool v)
|
|||||||
emit recordingChanged(v);
|
emit recordingChanged(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlProfilerTraceClientPrivate::updateFeatures(ProfileFeature feature)
|
||||||
|
{
|
||||||
|
quint64 flag = 1ULL << feature;
|
||||||
|
if (!(requestedFeatures & flag))
|
||||||
|
return false;
|
||||||
|
if (!(recordedFeatures & flag)) {
|
||||||
|
recordedFeatures |= flag;
|
||||||
|
emit q->recordedFeaturesChanged(recordedFeatures);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerTraceClient::stateChanged(State /*status*/)
|
void QmlProfilerTraceClient::stateChanged(State /*status*/)
|
||||||
{
|
{
|
||||||
emit enabledChanged();
|
emit enabledChanged();
|
||||||
@@ -200,7 +224,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AnimationFrame: {
|
case AnimationFrame: {
|
||||||
if (!(d->features & (1 << ProfileAnimations)))
|
if (!d->updateFeatures(ProfileAnimations))
|
||||||
break;
|
break;
|
||||||
int frameRate, animationCount;
|
int frameRate, animationCount;
|
||||||
int threadId;
|
int threadId;
|
||||||
@@ -218,7 +242,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
}
|
}
|
||||||
case Key:
|
case Key:
|
||||||
case Mouse:
|
case Mouse:
|
||||||
if (!(d->features & (1 << ProfileInputEvents)))
|
if (!d->updateFeatures(ProfileInputEvents))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
emit this->rangedEvent(Event, MaximumRangeType, subtype, time, 0, QString(),
|
emit this->rangedEvent(Event, MaximumRangeType, subtype, time, 0, QString(),
|
||||||
@@ -233,7 +257,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
emit complete(d->maximumTime);
|
emit complete(d->maximumTime);
|
||||||
break;
|
break;
|
||||||
case SceneGraphFrame: {
|
case SceneGraphFrame: {
|
||||||
if (!(d->features & (1 << ProfileSceneGraph)))
|
if (!d->updateFeatures(ProfileSceneGraph))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -250,7 +274,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PixmapCacheEvent: {
|
case PixmapCacheEvent: {
|
||||||
if (!(d->features & (1 << ProfilePixmapCache)))
|
if (!d->updateFeatures(ProfilePixmapCache))
|
||||||
break;
|
break;
|
||||||
int width = 0, height = 0, refcount = 0;
|
int width = 0, height = 0, refcount = 0;
|
||||||
QString pixUrl;
|
QString pixUrl;
|
||||||
@@ -268,7 +292,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MemoryAllocation: {
|
case MemoryAllocation: {
|
||||||
if (!(d->features & (1 << ProfileMemory)))
|
if (!d->updateFeatures(ProfileMemory))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
qint64 delta;
|
qint64 delta;
|
||||||
@@ -279,7 +303,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RangeStart: {
|
case RangeStart: {
|
||||||
if (!(d->features & (1ULL << featureFromRangeType(static_cast<RangeType>(subtype)))))
|
if (!d->updateFeatures(featureFromRangeType(static_cast<RangeType>(subtype))))
|
||||||
break;
|
break;
|
||||||
d->rangeStartTimes[subtype].push(time);
|
d->rangeStartTimes[subtype].push(time);
|
||||||
d->inProgressRanges |= (static_cast<qint64>(1) << subtype);
|
d->inProgressRanges |= (static_cast<qint64>(1) << subtype);
|
||||||
@@ -295,7 +319,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RangeData: {
|
case RangeData: {
|
||||||
if (!(d->features & (1ULL << featureFromRangeType(static_cast<RangeType>(subtype)))))
|
if (!d->updateFeatures(featureFromRangeType(static_cast<RangeType>(subtype))))
|
||||||
break;
|
break;
|
||||||
QString data;
|
QString data;
|
||||||
stream >> data;
|
stream >> data;
|
||||||
@@ -309,7 +333,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RangeLocation: {
|
case RangeLocation: {
|
||||||
if (!(d->features & (1ULL << featureFromRangeType(static_cast<RangeType>(subtype)))))
|
if (!d->updateFeatures(featureFromRangeType(static_cast<RangeType>(subtype))))
|
||||||
break;
|
break;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
int line;
|
int line;
|
||||||
@@ -324,7 +348,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RangeEnd: {
|
case RangeEnd: {
|
||||||
if (!(d->features & (1ULL << featureFromRangeType(static_cast<RangeType>(subtype)))))
|
if (!d->updateFeatures(featureFromRangeType(static_cast<RangeType>(subtype))))
|
||||||
break;
|
break;
|
||||||
if (d->rangeCount[subtype] == 0)
|
if (d->rangeCount[subtype] == 0)
|
||||||
break;
|
break;
|
||||||
|
@@ -57,11 +57,12 @@ public:
|
|||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
bool isRecording() const;
|
bool isRecording() const;
|
||||||
void setRecording(bool);
|
void setRecording(bool);
|
||||||
|
quint64 recordedFeatures() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clearData();
|
void clearData();
|
||||||
void sendRecordingStatus(int engineId = -1);
|
void sendRecordingStatus(int engineId = -1);
|
||||||
void setFeatures(quint64 features);
|
void setRequestedFeatures(quint64 features);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void complete(qint64 maximumTime);
|
void complete(qint64 maximumTime);
|
||||||
@@ -73,6 +74,7 @@ signals:
|
|||||||
const QmlDebug::QmlEventLocation &location, qint64 param1, qint64 param2,
|
const QmlDebug::QmlEventLocation &location, qint64 param1, qint64 param2,
|
||||||
qint64 param3, qint64 param4, qint64 param5);
|
qint64 param3, qint64 param4, qint64 param5);
|
||||||
void recordingChanged(bool arg);
|
void recordingChanged(bool arg);
|
||||||
|
void recordedFeaturesChanged(quint64 features);
|
||||||
|
|
||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
void cleared();
|
void cleared();
|
||||||
|
@@ -151,8 +151,9 @@ void QmlProfilerClientManager::enableServices()
|
|||||||
disconnectClientSignals();
|
disconnectClientSignals();
|
||||||
d->profilerState->setServerRecording(false); // false by default (will be set to true when connected)
|
d->profilerState->setServerRecording(false); // false by default (will be set to true when connected)
|
||||||
delete d->qmlclientplugin.data();
|
delete d->qmlclientplugin.data();
|
||||||
|
d->profilerState->setRecordedFeatures(0);
|
||||||
d->qmlclientplugin = new QmlProfilerTraceClient(d->connection,
|
d->qmlclientplugin = new QmlProfilerTraceClient(d->connection,
|
||||||
d->profilerState->recordingFeatures());
|
d->profilerState->requestedFeatures());
|
||||||
connectClientSignals();
|
connectClientSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,8 +179,10 @@ void QmlProfilerClientManager::connectClientSignals()
|
|||||||
d->qmlclientplugin.data(), SLOT(sendRecordingStatus()));
|
d->qmlclientplugin.data(), SLOT(sendRecordingStatus()));
|
||||||
connect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)),
|
connect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)),
|
||||||
d->profilerState, SLOT(setServerRecording(bool)));
|
d->profilerState, SLOT(setServerRecording(bool)));
|
||||||
connect(d->profilerState, SIGNAL(recordingFeaturesChanged(quint64)),
|
connect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
|
||||||
d->qmlclientplugin.data(), SLOT(setFeatures(quint64)));
|
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
|
||||||
|
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
|
||||||
|
d->profilerState, &QmlProfilerStateManager::setRecordedFeatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +206,10 @@ void QmlProfilerClientManager::disconnectClientSignals()
|
|||||||
// fixme: this should be unified for both clients
|
// fixme: this should be unified for both clients
|
||||||
disconnect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)),
|
disconnect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)),
|
||||||
d->profilerState, SLOT(setServerRecording(bool)));
|
d->profilerState, SLOT(setServerRecording(bool)));
|
||||||
disconnect(d->profilerState, SIGNAL(recordingFeaturesChanged(quint64)),
|
disconnect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
|
||||||
d->qmlclientplugin.data(), SLOT(setFeatures(quint64)));
|
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
|
||||||
|
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
|
||||||
|
d->profilerState, &QmlProfilerStateManager::setRecordedFeatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -178,7 +178,9 @@ public:
|
|||||||
|
|
||||||
QVector <double> partialCounts;
|
QVector <double> partialCounts;
|
||||||
QVector <int> partialCountWeights;
|
QVector <int> partialCountWeights;
|
||||||
quint64 features;
|
quint64 availableFeatures;
|
||||||
|
quint64 visibleFeatures;
|
||||||
|
quint64 recordedFeatures;
|
||||||
|
|
||||||
int totalWeight;
|
int totalWeight;
|
||||||
double progress;
|
double progress;
|
||||||
@@ -193,7 +195,9 @@ QmlProfilerModelManager::QmlProfilerModelManager(Utils::FileInProjectFinder *fin
|
|||||||
QObject(parent), d(new QmlProfilerModelManagerPrivate(this))
|
QObject(parent), d(new QmlProfilerModelManagerPrivate(this))
|
||||||
{
|
{
|
||||||
d->totalWeight = 0;
|
d->totalWeight = 0;
|
||||||
d->features = 0;
|
d->availableFeatures = 0;
|
||||||
|
d->visibleFeatures = 0;
|
||||||
|
d->recordedFeatures = 0;
|
||||||
d->model = new QmlProfilerDataModel(finder, this);
|
d->model = new QmlProfilerDataModel(finder, this);
|
||||||
d->dataState = new QmlProfilerDataState(this, this);
|
d->dataState = new QmlProfilerDataState(this, this);
|
||||||
d->traceTime = new QmlProfilerTraceTime(this);
|
d->traceTime = new QmlProfilerTraceTime(this);
|
||||||
@@ -272,15 +276,45 @@ void QmlProfilerModelManager::modelProxyCountUpdated(int proxyId, qint64 count,
|
|||||||
void QmlProfilerModelManager::announceFeatures(int proxyId, quint64 features)
|
void QmlProfilerModelManager::announceFeatures(int proxyId, quint64 features)
|
||||||
{
|
{
|
||||||
Q_UNUSED(proxyId); // Will use that later to optimize the event dispatching on loading.
|
Q_UNUSED(proxyId); // Will use that later to optimize the event dispatching on loading.
|
||||||
if ((features & d->features) != features) {
|
if ((features & d->availableFeatures) != features) {
|
||||||
d->features |= features;
|
d->availableFeatures |= features;
|
||||||
emit availableFeaturesChanged(d->features);
|
emit availableFeaturesChanged(d->availableFeatures);
|
||||||
|
}
|
||||||
|
if ((features & d->visibleFeatures) != features) {
|
||||||
|
d->visibleFeatures |= features;
|
||||||
|
emit visibleFeaturesChanged(d->visibleFeatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 QmlProfilerModelManager::availableFeatures()
|
quint64 QmlProfilerModelManager::availableFeatures() const
|
||||||
{
|
{
|
||||||
return d->features;
|
return d->availableFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 QmlProfilerModelManager::visibleFeatures() const
|
||||||
|
{
|
||||||
|
return d->visibleFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProfilerModelManager::setVisibleFeatures(quint64 features)
|
||||||
|
{
|
||||||
|
if (d->visibleFeatures != features) {
|
||||||
|
d->visibleFeatures = features;
|
||||||
|
emit visibleFeaturesChanged(d->visibleFeatures);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 QmlProfilerModelManager::recordedFeatures() const
|
||||||
|
{
|
||||||
|
return d->recordedFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProfilerModelManager::setRecordedFeatures(quint64 features)
|
||||||
|
{
|
||||||
|
if (d->recordedFeatures != features) {
|
||||||
|
d->recordedFeatures = features;
|
||||||
|
emit recordedFeaturesChanged(d->recordedFeatures);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *QmlProfilerModelManager::featureName(QmlDebug::ProfileFeature feature)
|
const char *QmlProfilerModelManager::featureName(QmlDebug::ProfileFeature feature)
|
||||||
@@ -398,6 +432,7 @@ void QmlProfilerModelManager::load()
|
|||||||
connect(&reader, &QmlProfilerFileReader::error, this, &QmlProfilerModelManager::error);
|
connect(&reader, &QmlProfilerFileReader::error, this, &QmlProfilerModelManager::error);
|
||||||
reader.setQmlDataModel(d->model);
|
reader.setQmlDataModel(d->model);
|
||||||
reader.load(file);
|
reader.load(file);
|
||||||
|
setRecordedFeatures(reader.loadedFeatures());
|
||||||
file->close();
|
file->close();
|
||||||
file->deleteLater();
|
file->deleteLater();
|
||||||
|
|
||||||
@@ -430,6 +465,8 @@ void QmlProfilerModelManager::clear()
|
|||||||
d->model->clear();
|
d->model->clear();
|
||||||
d->traceTime->clear();
|
d->traceTime->clear();
|
||||||
d->notesModel->clear();
|
d->notesModel->clear();
|
||||||
|
setVisibleFeatures(0);
|
||||||
|
setRecordedFeatures(0);
|
||||||
|
|
||||||
setState(QmlProfilerDataState::Empty);
|
setState(QmlProfilerDataState::Empty);
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,12 @@ public:
|
|||||||
void setProxyCountWeight(int proxyId, int weight);
|
void setProxyCountWeight(int proxyId, int weight);
|
||||||
void modelProxyCountUpdated(int proxyId, qint64 count, qint64 max);
|
void modelProxyCountUpdated(int proxyId, qint64 count, qint64 max);
|
||||||
void announceFeatures(int proxyId, quint64 features);
|
void announceFeatures(int proxyId, quint64 features);
|
||||||
quint64 availableFeatures();
|
quint64 availableFeatures() const;
|
||||||
|
quint64 visibleFeatures() const;
|
||||||
|
void setVisibleFeatures(quint64 features);
|
||||||
|
quint64 recordedFeatures() const;
|
||||||
|
void setRecordedFeatures(quint64 features);
|
||||||
|
|
||||||
static const char *featureName(QmlDebug::ProfileFeature feature);
|
static const char *featureName(QmlDebug::ProfileFeature feature);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -139,6 +144,8 @@ signals:
|
|||||||
|
|
||||||
void requestDetailsForLocation(int eventType, const QmlDebug::QmlEventLocation &location);
|
void requestDetailsForLocation(int eventType, const QmlDebug::QmlEventLocation &location);
|
||||||
void availableFeaturesChanged(quint64 features);
|
void availableFeaturesChanged(quint64 features);
|
||||||
|
void visibleFeaturesChanged(quint64 features);
|
||||||
|
void recordedFeaturesChanged(quint64 features);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
@@ -64,7 +64,8 @@ public:
|
|||||||
QmlProfilerStateManager::QmlProfilerState m_currentState;
|
QmlProfilerStateManager::QmlProfilerState m_currentState;
|
||||||
bool m_clientRecording;
|
bool m_clientRecording;
|
||||||
bool m_serverRecording;
|
bool m_serverRecording;
|
||||||
quint64 m_recordingFeatures;
|
quint64 m_requestedFeatures;
|
||||||
|
quint64 m_recordedFeatures;
|
||||||
};
|
};
|
||||||
QmlProfilerStateManager::QmlProfilerStateManager(QObject *parent) :
|
QmlProfilerStateManager::QmlProfilerStateManager(QObject *parent) :
|
||||||
QObject(parent),d(new QmlProfilerStateManagerPrivate(this))
|
QObject(parent),d(new QmlProfilerStateManagerPrivate(this))
|
||||||
@@ -72,7 +73,8 @@ QmlProfilerStateManager::QmlProfilerStateManager(QObject *parent) :
|
|||||||
d->m_currentState = Idle;
|
d->m_currentState = Idle;
|
||||||
d->m_clientRecording = true;
|
d->m_clientRecording = true;
|
||||||
d->m_serverRecording = false;
|
d->m_serverRecording = false;
|
||||||
d->m_recordingFeatures = 0;
|
d->m_requestedFeatures = 0;
|
||||||
|
d->m_recordedFeatures = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerStateManager::~QmlProfilerStateManager()
|
QmlProfilerStateManager::~QmlProfilerStateManager()
|
||||||
@@ -95,9 +97,14 @@ bool QmlProfilerStateManager::serverRecording()
|
|||||||
return d->m_serverRecording;
|
return d->m_serverRecording;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 QmlProfilerStateManager::recordingFeatures() const
|
quint64 QmlProfilerStateManager::requestedFeatures() const
|
||||||
{
|
{
|
||||||
return d->m_recordingFeatures;
|
return d->m_requestedFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 QmlProfilerStateManager::recordedFeatures() const
|
||||||
|
{
|
||||||
|
return d->m_recordedFeatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProfilerStateManager::currentStateAsString()
|
QString QmlProfilerStateManager::currentStateAsString()
|
||||||
@@ -180,11 +187,19 @@ void QmlProfilerStateManager::setServerRecording(bool recording)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerStateManager::setRecordingFeatures(quint64 features)
|
void QmlProfilerStateManager::setRequestedFeatures(quint64 features)
|
||||||
{
|
{
|
||||||
if (d->m_recordingFeatures != features) {
|
if (d->m_requestedFeatures != features) {
|
||||||
d->m_recordingFeatures = features;
|
d->m_requestedFeatures = features;
|
||||||
emit recordingFeaturesChanged(features);
|
emit requestedFeaturesChanged(features);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProfilerStateManager::setRecordedFeatures(quint64 features)
|
||||||
|
{
|
||||||
|
if (d->m_recordedFeatures != features) {
|
||||||
|
d->m_recordedFeatures = features;
|
||||||
|
emit recordedFeaturesChanged(features);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,7 +56,8 @@ public:
|
|||||||
QmlProfilerState currentState();
|
QmlProfilerState currentState();
|
||||||
bool clientRecording();
|
bool clientRecording();
|
||||||
bool serverRecording();
|
bool serverRecording();
|
||||||
quint64 recordingFeatures() const;
|
quint64 requestedFeatures() const;
|
||||||
|
quint64 recordedFeatures() const;
|
||||||
|
|
||||||
QString currentStateAsString();
|
QString currentStateAsString();
|
||||||
|
|
||||||
@@ -64,13 +65,15 @@ signals:
|
|||||||
void stateChanged();
|
void stateChanged();
|
||||||
void clientRecordingChanged();
|
void clientRecordingChanged();
|
||||||
void serverRecordingChanged();
|
void serverRecordingChanged();
|
||||||
void recordingFeaturesChanged(quint64);
|
void requestedFeaturesChanged(quint64);
|
||||||
|
void recordedFeaturesChanged(quint64);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentState(QmlProfilerState newState);
|
void setCurrentState(QmlProfilerState newState);
|
||||||
void setClientRecording(bool recording);
|
void setClientRecording(bool recording);
|
||||||
void setServerRecording(bool recording);
|
void setServerRecording(bool recording);
|
||||||
void setRecordingFeatures(quint64 features);
|
void setRequestedFeatures(quint64 features);
|
||||||
|
void setRecordedFeatures(quint64 features);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class QmlProfilerStateManagerPrivate;
|
class QmlProfilerStateManagerPrivate;
|
||||||
|
@@ -44,6 +44,8 @@ QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *mode
|
|||||||
{
|
{
|
||||||
connect(modelManager, &QmlProfilerModelManager::stateChanged,
|
connect(modelManager, &QmlProfilerModelManager::stateChanged,
|
||||||
this, &QmlProfilerTimelineModel::dataChanged);
|
this, &QmlProfilerTimelineModel::dataChanged);
|
||||||
|
connect(modelManager, &QmlProfilerModelManager::visibleFeaturesChanged,
|
||||||
|
this, &QmlProfilerTimelineModel::onVisibleFeaturesChanged);
|
||||||
announceFeatures(1ULL << m_mainFeature);
|
announceFeatures(1ULL << m_mainFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ public:
|
|||||||
QmlProfilerViewManager *m_viewContainer;
|
QmlProfilerViewManager *m_viewContainer;
|
||||||
Utils::FileInProjectFinder m_projectFinder;
|
Utils::FileInProjectFinder m_projectFinder;
|
||||||
QToolButton *m_recordButton;
|
QToolButton *m_recordButton;
|
||||||
QMenu *m_featuresMenu;
|
QMenu *m_recordFeaturesMenu;
|
||||||
|
|
||||||
QToolButton *m_clearButton;
|
QToolButton *m_clearButton;
|
||||||
|
|
||||||
@@ -113,6 +113,10 @@ public:
|
|||||||
// open search
|
// open search
|
||||||
QToolButton *m_searchButton;
|
QToolButton *m_searchButton;
|
||||||
|
|
||||||
|
// hide and show categories
|
||||||
|
QToolButton *m_displayFeaturesButton;
|
||||||
|
QMenu *m_displayFeaturesMenu;
|
||||||
|
|
||||||
// save and load actions
|
// save and load actions
|
||||||
QAction *m_saveQmlTrace;
|
QAction *m_saveQmlTrace;
|
||||||
QAction *m_loadQmlTrace;
|
QAction *m_loadQmlTrace;
|
||||||
@@ -126,15 +130,19 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
|||||||
d->m_profilerState = 0;
|
d->m_profilerState = 0;
|
||||||
d->m_viewContainer = 0;
|
d->m_viewContainer = 0;
|
||||||
d->m_recordButton = 0;
|
d->m_recordButton = 0;
|
||||||
d->m_featuresMenu = 0;
|
d->m_recordFeaturesMenu = 0;
|
||||||
d->m_clearButton = 0;
|
d->m_clearButton = 0;
|
||||||
d->m_timeLabel = 0;
|
d->m_timeLabel = 0;
|
||||||
d->m_searchButton = 0;
|
d->m_searchButton = 0;
|
||||||
|
d->m_displayFeaturesButton = 0;
|
||||||
|
d->m_displayFeaturesMenu = 0;
|
||||||
|
|
||||||
d->m_profilerState = new QmlProfilerStateManager(this);
|
d->m_profilerState = new QmlProfilerStateManager(this);
|
||||||
connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged()));
|
connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged()));
|
||||||
connect(d->m_profilerState, SIGNAL(clientRecordingChanged()), this, SLOT(clientRecordingChanged()));
|
connect(d->m_profilerState, SIGNAL(clientRecordingChanged()), this, SLOT(clientRecordingChanged()));
|
||||||
connect(d->m_profilerState, SIGNAL(serverRecordingChanged()), this, SLOT(serverRecordingChanged()));
|
connect(d->m_profilerState, SIGNAL(serverRecordingChanged()), this, SLOT(serverRecordingChanged()));
|
||||||
|
connect(d->m_profilerState, &QmlProfilerStateManager::recordedFeaturesChanged,
|
||||||
|
this, &QmlProfilerTool::setRecordedFeatures);
|
||||||
|
|
||||||
d->m_profilerConnections = new QmlProfilerClientManager(this);
|
d->m_profilerConnections = new QmlProfilerClientManager(this);
|
||||||
d->m_profilerConnections->registerProfilerStateManager(d->m_profilerState);
|
d->m_profilerConnections->registerProfilerStateManager(d->m_profilerState);
|
||||||
@@ -143,8 +151,8 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
|||||||
d->m_profilerModelManager = new QmlProfilerModelManager(&d->m_projectFinder, this);
|
d->m_profilerModelManager = new QmlProfilerModelManager(&d->m_projectFinder, this);
|
||||||
connect(d->m_profilerModelManager, SIGNAL(stateChanged()), this, SLOT(profilerDataModelStateChanged()));
|
connect(d->m_profilerModelManager, SIGNAL(stateChanged()), this, SLOT(profilerDataModelStateChanged()));
|
||||||
connect(d->m_profilerModelManager, SIGNAL(error(QString)), this, SLOT(showErrorDialog(QString)));
|
connect(d->m_profilerModelManager, SIGNAL(error(QString)), this, SLOT(showErrorDialog(QString)));
|
||||||
connect(d->m_profilerModelManager, SIGNAL(availableFeaturesChanged(quint64)),
|
connect(d->m_profilerModelManager, &QmlProfilerModelManager::availableFeaturesChanged,
|
||||||
this, SLOT(setAvailableFeatures(quint64)));
|
this, &QmlProfilerTool::setAvailableFeatures);
|
||||||
connect(d->m_profilerModelManager, &QmlProfilerModelManager::saveFinished,
|
connect(d->m_profilerModelManager, &QmlProfilerModelManager::saveFinished,
|
||||||
this, &QmlProfilerTool::onLoadSaveFinished);
|
this, &QmlProfilerTool::onLoadSaveFinished);
|
||||||
connect(d->m_profilerModelManager, &QmlProfilerModelManager::loadFinished,
|
connect(d->m_profilerModelManager, &QmlProfilerModelManager::loadFinished,
|
||||||
@@ -246,12 +254,11 @@ QWidget *QmlProfilerTool::createWidgets()
|
|||||||
|
|
||||||
connect(d->m_recordButton,SIGNAL(clicked(bool)), this, SLOT(recordingButtonChanged(bool)));
|
connect(d->m_recordButton,SIGNAL(clicked(bool)), this, SLOT(recordingButtonChanged(bool)));
|
||||||
d->m_recordButton->setChecked(true);
|
d->m_recordButton->setChecked(true);
|
||||||
d->m_featuresMenu = new QMenu(d->m_recordButton);
|
d->m_recordFeaturesMenu = new QMenu(d->m_recordButton);
|
||||||
d->m_recordButton->setMenu(d->m_featuresMenu);
|
d->m_recordButton->setMenu(d->m_recordFeaturesMenu);
|
||||||
d->m_recordButton->setPopupMode(QToolButton::MenuButtonPopup);
|
d->m_recordButton->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
setAvailableFeatures(d->m_profilerModelManager->availableFeatures());
|
connect(d->m_recordFeaturesMenu, SIGNAL(triggered(QAction*)),
|
||||||
connect(d->m_featuresMenu, SIGNAL(triggered(QAction*)),
|
this, SLOT(toggleRequestedFeature(QAction*)));
|
||||||
this, SLOT(toggleRecordingFeature(QAction*)));
|
|
||||||
|
|
||||||
setRecording(d->m_profilerState->clientRecording());
|
setRecording(d->m_profilerState->clientRecording());
|
||||||
layout->addWidget(d->m_recordButton);
|
layout->addWidget(d->m_recordButton);
|
||||||
@@ -282,8 +289,21 @@ QWidget *QmlProfilerTool::createWidgets()
|
|||||||
|
|
||||||
connect(d->m_searchButton, &QToolButton::clicked, this, &QmlProfilerTool::showTimeLineSearch);
|
connect(d->m_searchButton, &QToolButton::clicked, this, &QmlProfilerTool::showTimeLineSearch);
|
||||||
|
|
||||||
|
d->m_displayFeaturesButton = new QToolButton;
|
||||||
|
d->m_displayFeaturesButton->setIcon(QIcon(QLatin1String(ICON_FILTER)));
|
||||||
|
d->m_displayFeaturesButton->setToolTip(tr("Hide or show event categories."));
|
||||||
|
d->m_displayFeaturesButton->setPopupMode(QToolButton::InstantPopup);
|
||||||
|
d->m_displayFeaturesMenu = new QMenu(d->m_displayFeaturesButton);
|
||||||
|
d->m_displayFeaturesButton->setMenu(d->m_displayFeaturesMenu);
|
||||||
|
connect(d->m_displayFeaturesMenu, &QMenu::triggered,
|
||||||
|
this, &QmlProfilerTool::toggleVisibleFeature);
|
||||||
|
layout->addWidget(d->m_displayFeaturesButton);
|
||||||
|
|
||||||
layout->addStretch();
|
layout->addStretch();
|
||||||
|
|
||||||
toolbarWidget->setLayout(layout);
|
toolbarWidget->setLayout(layout);
|
||||||
|
setAvailableFeatures(d->m_profilerModelManager->availableFeatures());
|
||||||
|
setRecordedFeatures(0);
|
||||||
|
|
||||||
// When the widgets are requested we assume that the session data
|
// When the widgets are requested we assume that the session data
|
||||||
// is available, then we can populate the file finder
|
// is available, then we can populate the file finder
|
||||||
@@ -407,6 +427,7 @@ void QmlProfilerTool::clearData()
|
|||||||
{
|
{
|
||||||
d->m_profilerModelManager->clear();
|
d->m_profilerModelManager->clear();
|
||||||
d->m_profilerConnections->discardPendingData();
|
d->m_profilerConnections->discardPendingData();
|
||||||
|
setRecordedFeatures(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::clearDisplay()
|
void QmlProfilerTool::clearDisplay()
|
||||||
@@ -531,12 +552,16 @@ void QmlProfilerTool::showLoadDialog()
|
|||||||
|
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
AnalyzerManager::mainWindow()->setEnabled(false);
|
AnalyzerManager::mainWindow()->setEnabled(false);
|
||||||
|
connect(d->m_profilerModelManager, &QmlProfilerModelManager::recordedFeaturesChanged,
|
||||||
|
this, &QmlProfilerTool::setRecordedFeatures);
|
||||||
d->m_profilerModelManager->load(filename);
|
d->m_profilerModelManager->load(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::onLoadSaveFinished()
|
void QmlProfilerTool::onLoadSaveFinished()
|
||||||
{
|
{
|
||||||
|
disconnect(d->m_profilerModelManager, &QmlProfilerModelManager::recordedFeaturesChanged,
|
||||||
|
this, &QmlProfilerTool::setRecordedFeatures);
|
||||||
AnalyzerManager::mainWindow()->setEnabled(true);
|
AnalyzerManager::mainWindow()->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,6 +581,18 @@ bool QmlProfilerTool::checkForUnsavedNotes()
|
|||||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes;
|
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTool::restoreFeatureVisibility()
|
||||||
|
{
|
||||||
|
// Restore the shown/hidden state of features to what the user selected. When clearing data the
|
||||||
|
// the model manager sets its features to 0, and models get automatically shown, for the mockup.
|
||||||
|
quint64 features = 0;
|
||||||
|
foreach (const QAction *action, d->m_displayFeaturesMenu->actions()) {
|
||||||
|
if (action->isChecked())
|
||||||
|
features |= (1ULL << action->data().toUInt());
|
||||||
|
}
|
||||||
|
d->m_profilerModelManager->setVisibleFeatures(features);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::clientsDisconnected()
|
void QmlProfilerTool::clientsDisconnected()
|
||||||
{
|
{
|
||||||
// If the application stopped by itself, check if we have all the data
|
// If the application stopped by itself, check if we have all the data
|
||||||
@@ -571,21 +608,29 @@ void QmlProfilerTool::clientsDisconnected()
|
|||||||
// If the connection is closed while the app is still running, no special action is needed
|
// If the connection is closed while the app is still running, no special action is needed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addFeatureToMenu(QMenu *menu, ProfileFeature feature, quint64 enabledFeatures)
|
||||||
|
{
|
||||||
|
QAction *action =
|
||||||
|
menu->addAction(QmlProfilerTool::tr(QmlProfilerModelManager::featureName(feature)));
|
||||||
|
action->setCheckable(true);
|
||||||
|
action->setData(static_cast<uint>(feature));
|
||||||
|
action->setChecked(enabledFeatures & (1ULL << (feature)));
|
||||||
|
}
|
||||||
|
|
||||||
template<ProfileFeature feature>
|
template<ProfileFeature feature>
|
||||||
void QmlProfilerTool::updateFeaturesMenu(quint64 features)
|
void QmlProfilerTool::updateFeatures(quint64 features)
|
||||||
{
|
{
|
||||||
if (features & (1ULL << (feature))) {
|
if (features & (1ULL << (feature))) {
|
||||||
QAction *action = d->m_featuresMenu->addAction(tr(QmlProfilerModelManager::featureName(
|
addFeatureToMenu(d->m_recordFeaturesMenu, feature,
|
||||||
static_cast<ProfileFeature>(feature))));
|
d->m_profilerState->requestedFeatures());
|
||||||
action->setCheckable(true);
|
addFeatureToMenu(d->m_displayFeaturesMenu, feature,
|
||||||
action->setData(static_cast<uint>(feature));
|
d->m_profilerModelManager->visibleFeatures());
|
||||||
action->setChecked(d->m_profilerState->recordingFeatures() & (1ULL << (feature)));
|
|
||||||
}
|
}
|
||||||
updateFeaturesMenu<static_cast<ProfileFeature>(feature + 1)>(features);
|
updateFeatures<static_cast<ProfileFeature>(feature + 1)>(features);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void QmlProfilerTool::updateFeaturesMenu<MaximumProfileFeature>(quint64 features)
|
void QmlProfilerTool::updateFeatures<MaximumProfileFeature>(quint64 features)
|
||||||
{
|
{
|
||||||
Q_UNUSED(features);
|
Q_UNUSED(features);
|
||||||
return;
|
return;
|
||||||
@@ -593,14 +638,21 @@ void QmlProfilerTool::updateFeaturesMenu<MaximumProfileFeature>(quint64 features
|
|||||||
|
|
||||||
void QmlProfilerTool::setAvailableFeatures(quint64 features)
|
void QmlProfilerTool::setAvailableFeatures(quint64 features)
|
||||||
{
|
{
|
||||||
if (features != d->m_profilerState->recordingFeatures())
|
if (features != d->m_profilerState->requestedFeatures())
|
||||||
d->m_profilerState->setRecordingFeatures(features); // by default, enable them all.
|
d->m_profilerState->setRequestedFeatures(features); // by default, enable them all.
|
||||||
if (d->m_featuresMenu) {
|
if (d->m_recordFeaturesMenu && d->m_displayFeaturesMenu) {
|
||||||
d->m_featuresMenu->clear();
|
d->m_recordFeaturesMenu->clear();
|
||||||
updateFeaturesMenu<static_cast<ProfileFeature>(0)>(features);
|
d->m_displayFeaturesMenu->clear();
|
||||||
|
updateFeatures<static_cast<ProfileFeature>(0)>(features);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTool::setRecordedFeatures(quint64 features)
|
||||||
|
{
|
||||||
|
foreach (QAction *action, d->m_displayFeaturesMenu->actions())
|
||||||
|
action->setEnabled(features & (1ULL << action->data().toUInt()));
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::profilerDataModelStateChanged()
|
void QmlProfilerTool::profilerDataModelStateChanged()
|
||||||
{
|
{
|
||||||
switch (d->m_profilerModelManager->state()) {
|
switch (d->m_profilerModelManager->state()) {
|
||||||
@@ -618,6 +670,7 @@ void QmlProfilerTool::profilerDataModelStateChanged()
|
|||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppReadyToStop);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppReadyToStop);
|
||||||
showSaveOption();
|
showSaveOption();
|
||||||
updateTimeDisplay();
|
updateTimeDisplay();
|
||||||
|
restoreFeatureVisibility();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -715,19 +768,33 @@ void QmlProfilerTool::serverRecordingChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::toggleRecordingFeature(QAction *action)
|
void QmlProfilerTool::toggleRequestedFeature(QAction *action)
|
||||||
{
|
{
|
||||||
uint feature = action->data().toUInt();
|
uint feature = action->data().toUInt();
|
||||||
if (action->isChecked())
|
if (action->isChecked())
|
||||||
d->m_profilerState->setRecordingFeatures(
|
d->m_profilerState->setRequestedFeatures(
|
||||||
d->m_profilerState->recordingFeatures() | (1ULL << feature));
|
d->m_profilerState->requestedFeatures() | (1ULL << feature));
|
||||||
else
|
else
|
||||||
d->m_profilerState->setRecordingFeatures(
|
d->m_profilerState->setRequestedFeatures(
|
||||||
d->m_profilerState->recordingFeatures() & (~(1ULL << feature)));
|
d->m_profilerState->requestedFeatures() & (~(1ULL << feature)));
|
||||||
|
|
||||||
// Keep the menu open to allow for more features to be toggled
|
// Keep the menu open to allow for more features to be toggled
|
||||||
d->m_recordButton->showMenu();
|
d->m_recordButton->showMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTool::toggleVisibleFeature(QAction *action)
|
||||||
|
{
|
||||||
|
uint feature = action->data().toUInt();
|
||||||
|
if (action->isChecked())
|
||||||
|
d->m_profilerModelManager->setVisibleFeatures(
|
||||||
|
d->m_profilerModelManager->visibleFeatures() | (1ULL << feature));
|
||||||
|
else
|
||||||
|
d->m_profilerModelManager->setVisibleFeatures(
|
||||||
|
d->m_profilerModelManager->visibleFeatures() & (~(1ULL << feature)));
|
||||||
|
|
||||||
|
// Keep the menu open to allow for more features to be toggled
|
||||||
|
d->m_displayFeaturesButton->showMenu();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,6 +76,7 @@ public slots:
|
|||||||
void serverRecordingChanged();
|
void serverRecordingChanged();
|
||||||
void clientsDisconnected();
|
void clientsDisconnected();
|
||||||
void setAvailableFeatures(quint64 features);
|
void setAvailableFeatures(quint64 features);
|
||||||
|
void setRecordedFeatures(quint64 features);
|
||||||
|
|
||||||
void recordingButtonChanged(bool recording);
|
void recordingButtonChanged(bool recording);
|
||||||
void setRecording(bool recording);
|
void setRecording(bool recording);
|
||||||
@@ -95,14 +96,16 @@ private slots:
|
|||||||
void showLoadDialog();
|
void showLoadDialog();
|
||||||
void onLoadSaveFinished();
|
void onLoadSaveFinished();
|
||||||
|
|
||||||
void toggleRecordingFeature(QAction *action);
|
void toggleRequestedFeature(QAction *action);
|
||||||
|
void toggleVisibleFeature(QAction *action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clearDisplay();
|
void clearDisplay();
|
||||||
void populateFileFinder(QString projectDirectory = QString(), QString activeSysroot = QString());
|
void populateFileFinder(QString projectDirectory = QString(), QString activeSysroot = QString());
|
||||||
template<QmlDebug::ProfileFeature feature>
|
template<QmlDebug::ProfileFeature feature>
|
||||||
void updateFeaturesMenu(quint64 features);
|
void updateFeatures(quint64 features);
|
||||||
bool checkForUnsavedNotes();
|
bool checkForUnsavedNotes();
|
||||||
|
void restoreFeatureVisibility();
|
||||||
|
|
||||||
class QmlProfilerToolPrivate;
|
class QmlProfilerToolPrivate;
|
||||||
QmlProfilerToolPrivate *d;
|
QmlProfilerToolPrivate *d;
|
||||||
|
@@ -121,7 +121,8 @@ static QString qmlTypeAsString(Message message, RangeType rangeType)
|
|||||||
|
|
||||||
QmlProfilerFileReader::QmlProfilerFileReader(QObject *parent) :
|
QmlProfilerFileReader::QmlProfilerFileReader(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_future(0)
|
m_future(0),
|
||||||
|
m_loadedFeatures(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +200,37 @@ bool QmlProfilerFileReader::load(QIODevice *device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 QmlProfilerFileReader::loadedFeatures() const
|
||||||
|
{
|
||||||
|
return m_loadedFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
|
QmlDebug::ProfileFeature featureFromEvent(const QmlProfilerDataModel::QmlEventTypeData &event) {
|
||||||
|
if (event.rangeType < MaximumRangeType)
|
||||||
|
return featureFromRangeType(event.rangeType);
|
||||||
|
|
||||||
|
switch (event.message) {
|
||||||
|
case Event:
|
||||||
|
switch (event.detailType) {
|
||||||
|
case AnimationFrame:
|
||||||
|
return ProfileAnimations;
|
||||||
|
case Key:
|
||||||
|
case Mouse:
|
||||||
|
return ProfileInputEvents;
|
||||||
|
default:
|
||||||
|
return MaximumProfileFeature;
|
||||||
|
}
|
||||||
|
case PixmapCacheEvent:
|
||||||
|
return ProfilePixmapCache;
|
||||||
|
case SceneGraphFrame:
|
||||||
|
return ProfileSceneGraph;
|
||||||
|
case MemoryAllocation:
|
||||||
|
return ProfileMemory;
|
||||||
|
default:
|
||||||
|
return MaximumProfileFeature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream)
|
void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(stream.name() == _("eventData"), return);
|
QTC_ASSERT(stream.name() == _("eventData"), return);
|
||||||
@@ -308,6 +340,9 @@ void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream)
|
|||||||
if (eventIndex >= m_qmlEvents.size())
|
if (eventIndex >= m_qmlEvents.size())
|
||||||
m_qmlEvents.resize(eventIndex + 1);
|
m_qmlEvents.resize(eventIndex + 1);
|
||||||
m_qmlEvents[eventIndex] = event;
|
m_qmlEvents[eventIndex] = event;
|
||||||
|
ProfileFeature feature = featureFromEvent(event);
|
||||||
|
if (feature != MaximumProfileFeature)
|
||||||
|
m_loadedFeatures |= (1ULL << static_cast<uint>(feature));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -59,6 +59,7 @@ public:
|
|||||||
void setFuture(QFutureInterface<void> *future);
|
void setFuture(QFutureInterface<void> *future);
|
||||||
|
|
||||||
bool load(QIODevice *device);
|
bool load(QIODevice *device);
|
||||||
|
quint64 loadedFeatures() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void error(const QString &error);
|
void error(const QString &error);
|
||||||
@@ -75,6 +76,7 @@ private:
|
|||||||
QVector<QmlProfilerDataModel::QmlEventTypeData> m_qmlEvents;
|
QVector<QmlProfilerDataModel::QmlEventTypeData> m_qmlEvents;
|
||||||
QVector<QmlProfilerDataModel::QmlEventData> m_ranges;
|
QVector<QmlProfilerDataModel::QmlEventData> m_ranges;
|
||||||
QVector<QmlProfilerDataModel::QmlEventNoteData> m_notes;
|
QVector<QmlProfilerDataModel::QmlEventNoteData> m_notes;
|
||||||
|
quint64 m_loadedFeatures;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user