summaryrefslogtreecommitdiff
path: root/src/plugins/qmlprofiler/qv8profilerdatamodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmlprofiler/qv8profilerdatamodel.h')
-rw-r--r--src/plugins/qmlprofiler/qv8profilerdatamodel.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/plugins/qmlprofiler/qv8profilerdatamodel.h b/src/plugins/qmlprofiler/qv8profilerdatamodel.h
new file mode 100644
index 0000000000..6441a24702
--- /dev/null
+++ b/src/plugins/qmlprofiler/qv8profilerdatamodel.h
@@ -0,0 +1,79 @@
+#ifndef QV8PROFILERDATAMODEL_H
+#define QV8PROFILERDATAMODEL_H
+
+#include <QObject>
+#include <QHash>
+
+#include <QXmlStreamReader>
+#include <QXmlStreamWriter>
+
+namespace QmlProfiler {
+namespace Internal {
+
+class QmlProfilerDataModel;
+struct QV8EventSub;
+
+struct QV8EventData
+{
+ QV8EventData();
+ ~QV8EventData();
+
+ QString displayName;
+ QString eventHashStr;
+ QString filename;
+ QString functionName;
+ int line;
+ double totalTime; // given in milliseconds
+ double totalPercent;
+ double selfTime;
+ double selfPercent;
+ QHash <QString, QV8EventSub *> parentHash;
+ QHash <QString, QV8EventSub *> childrenHash;
+ int eventId;
+
+ QV8EventData &operator=(const QV8EventData &ref);
+};
+
+struct QV8EventSub {
+ QV8EventSub(QV8EventData *from) : reference(from), totalTime(0) {}
+ QV8EventSub(QV8EventSub *from) : reference(from->reference), totalTime(from->totalTime) {}
+
+ QV8EventData *reference;
+ qint64 totalTime;
+};
+
+class QV8ProfilerDataModel : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QV8ProfilerDataModel(QObject *parent, QmlProfilerDataModel *profilerDataModel);
+ ~QV8ProfilerDataModel();
+
+ void clear();
+ bool isEmpty() const;
+ QList<QV8EventData *> getV8Events() const;
+ QV8EventData *v8EventDescription(int eventId) const;
+
+ qint64 v8MeasuredTime() const;
+ void collectV8Statistics();
+
+ void save(QXmlStreamWriter &stream);
+ void load(QXmlStreamReader &stream);
+
+public slots:
+ void addV8Event(int depth,
+ const QString &function,
+ const QString &filename,
+ int lineNumber,
+ double totalTime,
+ double selfTime);
+
+private:
+ class QV8ProfilerDataModelPrivate;
+ QV8ProfilerDataModelPrivate *d;
+};
+
+} // namespace Internal
+} // namespace QmlProfiler
+
+#endif // QV8PROFILERDATAMODEL_H