1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QV4PROFILERADAPTER_P_H
5#define QV4PROFILERADAPTER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qqmlprofilerservice.h"
19
20#include <private/qv4profiling_p.h>
21#include <private/qqmlabstractprofileradapter_p.h>
22
23#include <QStack>
24#include <QList>
25
26QT_BEGIN_NAMESPACE
27
28class QQmlProfilerService;
29class QV4ProfilerAdapter : public QQmlAbstractProfilerAdapter {
30 Q_OBJECT
31
32public:
33 QV4ProfilerAdapter(QQmlProfilerService *service, QV4::ExecutionEngine *engine);
34
35 virtual qint64 sendMessages(qint64 until, QList<QByteArray> &messages) override;
36
37 void receiveData(const QV4::Profiling::FunctionLocationHash &,
38 const QVector<QV4::Profiling::FunctionCallProperties> &,
39 const QVector<QV4::Profiling::MemoryAllocationProperties> &);
40
41Q_SIGNALS:
42 void v4ProfilingEnabled(quint64 v4Features);
43 void v4ProfilingEnabledWhileWaiting(quint64 v4Features);
44
45private:
46 QV4::Profiling::FunctionLocationHash m_functionLocations;
47 QVector<QV4::Profiling::FunctionCallProperties> m_functionCallData;
48 QVector<QV4::Profiling::MemoryAllocationProperties> m_memoryData;
49 int m_functionCallPos;
50 int m_memoryPos;
51 QStack<qint64> m_stack;
52 qint64 appendMemoryEvents(qint64 until, QList<QByteArray> &messages, QQmlDebugPacket &d);
53 qint64 finalizeMessages(qint64 until, QList<QByteArray> &messages, qint64 callNext,
54 QQmlDebugPacket &d);
55 void forwardEnabled(quint64 features);
56 void forwardEnabledWhileWaiting(quint64 features);
57
58 static quint64 translateFeatures(quint64 qmlFeatures);
59};
60
61QT_END_NAMESPACE
62
63#endif // QV4PROFILERADAPTER_P_H
64

source code of qtdeclarative/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h