1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef TRACER_H |
5 | #define TRACER_H |
6 | |
7 | #include <QtCore/QtGlobal> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class Tracer |
12 | { |
13 | public: |
14 | Tracer(const char *func) : m_func(func) |
15 | { |
16 | qDebug(msg: "Entering function %s." , m_func); |
17 | } |
18 | |
19 | ~Tracer() |
20 | { |
21 | qDebug(msg: "Leaving function %s." , m_func); |
22 | } |
23 | |
24 | private: |
25 | const char * const m_func; |
26 | }; |
27 | |
28 | QT_END_NAMESPACE |
29 | |
30 | // #define TRACING_REQUESTED |
31 | #ifdef TRACING_REQUESTED |
32 | #define TRACE_OBJ Tracer traceObj__(Q_FUNC_INFO); |
33 | #else |
34 | #define TRACE_OBJ |
35 | #endif |
36 | |
37 | #endif // TRACER_H |
38 | |