blob: 6441a24702aea2db5839fe1a3672daac1ec48495 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
|