aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmlprofilertracefile.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-04-05 09:47:33 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-04-19 08:09:07 +0000
commit1c2e0f387f552d3fbe98050f8629c11829ec95f7 (patch)
tree1a03f9f0e5c68f384d5940f19a59017f648a820a /src/plugins/qmlprofiler/qmlprofilertracefile.h
parent7099f215865d90b69906dc92da77857fa0e66165 (diff)
QmlProfiler: Move parts of model manager and trace file to Timeline
This way we can use the trace file loading and saving mechanism for other profilers. Change-Id: I98ec1cdde6f7abcea152cabf72e64d4e696dfa59 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertracefile.h')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertracefile.h75
1 files changed, 16 insertions, 59 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.h b/src/plugins/qmlprofiler/qmlprofilertracefile.h
index 929858d0316..0d9321a5290 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.h
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.h
@@ -32,6 +32,8 @@
#include "qmlevent.h"
#include "qmlprofilermodelmanager.h"
+#include <timeline/timelinetracefile.h>
+
#include <QFutureInterface>
#include <QObject>
#include <QVector>
@@ -44,81 +46,36 @@ QT_FORWARD_DECLARE_CLASS(QXmlStreamReader)
namespace QmlProfiler {
namespace Internal {
-class QmlProfilerFileReader : public QObject
+class QmlProfilerTraceFile : public Timeline::TimelineTraceFile
{
Q_OBJECT
public:
- explicit QmlProfilerFileReader(QObject *parent = 0);
+ explicit QmlProfilerTraceFile(QObject *parent = nullptr);
- void setFuture(QFutureInterface<void> *future);
+ void load(QIODevice *device) final;
+ void save(QIODevice *device) final;
+private:
+ QmlProfilerModelManager *modelManager();
+ QmlProfilerNotesModel *qmlNotes();
void loadQtd(QIODevice *device);
void loadQzt(QIODevice *device);
+ void saveQtd(QIODevice *device);
+ void saveQzt(QIODevice *device);
- quint64 loadedFeatures() const;
-
- qint64 traceStart() const { return m_traceStart; }
- qint64 traceEnd() const { return m_traceEnd; }
-
-signals:
- void typesLoaded(const QVector<QmlProfiler::QmlEventType> &types);
- void notesLoaded(const QVector<QmlProfiler::QmlNote> &notes);
- void qmlEventsLoaded(const QVector<QmlProfiler::QmlEvent> &event);
- void error(const QString &error);
- void success();
- void canceled();
-
-private:
void loadEventTypes(QXmlStreamReader &reader);
void loadEvents(QXmlStreamReader &reader);
void loadNotes(QXmlStreamReader &reader);
- void updateProgress(QIODevice *device);
- bool isCanceled() const;
-
- qint64 m_traceStart, m_traceEnd;
- QFutureInterface<void> *m_future;
- QVector<QmlEventType> m_eventTypes;
- QVector<QmlNote> m_notes;
- quint64 m_loadedFeatures;
-};
-
-
-class QmlProfilerFileWriter : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QmlProfilerFileWriter(QObject *parent = 0);
-
- void setTraceTime(qint64 startTime, qint64 endTime, qint64 measturedTime);
- void setData(const QmlProfilerModelManager *model);
- void setNotes(const QVector<QmlNote> &notes);
- void setFuture(QFutureInterface<void> *future);
-
- void saveQtd(QIODevice *device);
- void saveQzt(QFile *file);
-
-signals:
- void error(const QString &error);
- void success();
- void canceled();
-
-private:
- void updateProgress(qint64 timestamp);
- bool isCanceled() const;
enum ProgressValues {
- ProgressTypes = -128,
- ProgressNotes = -32,
- ProgressEvents = 1024,
- ProgressTotal = ProgressEvents - ProgressTypes - ProgressNotes
+ ProgressTypes = 128,
+ ProgressNotes = 32,
+ ProgressEvents = MaximumProgress - ProgressTypes - ProgressNotes - MinimumProgress,
};
- qint64 m_startTime, m_endTime, m_measuredTime;
- QFutureInterface<void> *m_future;
- const QmlProfilerModelManager *m_modelManager;
- QVector<QmlNote> m_notes;
+ void addEventsProgress(qint64 timestamp);
+ void addStageProgress(ProgressValues stage);
};