aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4profiling_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4profiling_p.h')
-rw-r--r--src/qml/jsruntime/qv4profiling_p.h41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index a422dd0fb6..c684d48368 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -59,6 +59,22 @@
QT_BEGIN_NAMESPACE
+#define Q_V4_PROFILE_ALLOC(engine, size, type)\
+ (engine->profiler &&\
+ (engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
+ engine->profiler->trackAlloc(size, type) : false)
+
+#define Q_V4_PROFILE_DEALLOC(engine, size, type) \
+ (engine->profiler &&\
+ (engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
+ engine->profiler->trackDealloc(size, type) : false)
+
+#define Q_V4_PROFILE(engine, function)\
+ (engine->profiler &&\
+ (engine->profiler->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
+ Profiling::FunctionCallProfiler::profileCall(engine->profiler, engine, function) :\
+ function->code(engine, function->codeData))
+
namespace QV4 {
namespace Profiling {
@@ -150,25 +166,8 @@ private:
qint64 m_end;
};
-#define Q_V4_PROFILE_ALLOC(engine, size, type)\
- (engine->profiler &&\
- (engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
- engine->profiler->trackAlloc(size, type) : size)
-
-#define Q_V4_PROFILE_DEALLOC(engine, pointer, size, type) \
- (engine->profiler &&\
- (engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
- engine->profiler->trackDealloc(pointer, size, type) : pointer)
-
-#define Q_V4_PROFILE(engine, function)\
- (engine->profiler &&\
- (engine->profiler->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
- Profiling::FunctionCallProfiler::profileCall(engine->profiler, engine, function) :\
- function->code(engine, function->codeData))
-
class Q_QML_EXPORT Profiler : public QObject {
Q_OBJECT
- Q_DISABLE_COPY(Profiler)
public:
struct SentMarker {
SentMarker() : m_function(nullptr) {}
@@ -212,18 +211,18 @@ public:
Profiler(QV4::ExecutionEngine *engine);
- size_t trackAlloc(size_t size, MemoryType type)
+ bool trackAlloc(size_t size, MemoryType type)
{
MemoryAllocationProperties allocation = {m_timer.nsecsElapsed(), (qint64)size, type};
m_memory_data.append(allocation);
- return size;
+ return true;
}
- void *trackDealloc(void *pointer, size_t size, MemoryType type)
+ bool trackDealloc(size_t size, MemoryType type)
{
MemoryAllocationProperties allocation = {m_timer.nsecsElapsed(), -(qint64)size, type};
m_memory_data.append(allocation);
- return pointer;
+ return true;
}
quint64 featuresEnabled;