Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtracecallback_p.h
Go to the documentation of this file.
1
// Copyright (C) 2026 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
QTRACECALLBACK_P_H
5
#
define
QTRACECALLBACK_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
<
QtCore
/
private
/
qglobal_p
.
h
>
19
20
QT_REQUIRE_CONFIG
(
tracecallback
);
21
22
QT_BEGIN_NAMESPACE
23
24
// The "callback" tracegen backend turns every Q_TRACE point into a call to a
25
// single process-wide hook, passing a pointer to a static descriptor of the
26
// firing point and the arguments as varargs. The callback is supposed to figure
27
// out what to do with the arguments using the tracepoint name/provider. It is
28
// meant for in-process profilers (e.g. benchmarks) that need to attribute time
29
// to the tracepoint that is currently executing. As such, the use cases are
30
// specialized for a finite collection of trace points of which we can
31
// statically know the argument types.
32
struct
QTraceCallbackTracepoint
33
{
34
const
char
*provider;
35
const
char
*name;
36
// Scratch space owned by the installed callback. The generated code initialises it
37
// to -1; the callback may cache whatever it resolves the descriptor to (e.g. a
38
// category id, or entry/exit kind) so that repeated firings of a hot tracepoint do
39
// not re-parse the name. Each descriptor is a unique, stable object, so its address
40
// doubles as an identity key.
41
qint64 cookie;
42
};
43
44
using
QTraceCallbackFunction
=
void
(*)(QTraceCallbackTracepoint *...);
45
46
// Read on every tracepoint firing by the generated wrappers; set via qSetTraceCallback().
47
// Plain pointer on purpose: it is expected to be installed once before a measured region
48
// and left untouched while tracing, so the hot-path read needs no synchronisation.
49
Q_CORE_EXPORT
extern
QTraceCallbackFunction
qtTraceCallbackFunction;
50
51
// Installs (or clears, with nullptr) the trace callback and returns the previous one.
52
Q_CORE_EXPORT
QTraceCallbackFunction
qSetTraceCallback(QTraceCallbackFunction callback);
53
54
QT_END_NAMESPACE
55
56
#
endif
// QTRACECALLBACK_P_H
QTraceCallbackFunction
void(*)(QTraceCallbackTracepoint *...) QTraceCallbackFunction
Definition
qtracecallback_p.h:44
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(tracecallback)
qtbase
src
corelib
tracing
qtracecallback_p.h
Generated on
for Qt by
1.16.1