[ Web Proxy ]
URL:
Viewing:
https://github-redirect.dependabot.com/python/cpython/blob/main/Include/cpython/monitoring.h
[Back]
[Original]
cpython/Include/cpython/monitoring.h at main python/cpython GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
python
cpython
Repository navigation
Code
Issues
5k+
(5k+)
Pull requests
2.7k
(2.7k)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
cpython
/
Include
/
cpython
/
monitoring.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
285 lines (229 loc) 8.57 KB
main
Breadcrumbs
cpython
/
Include
/
cpython
/
monitoring.h
Copy path
Top
File metadata and controls
Code
Blame
285 lines (229 loc) 8.57 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#ifndef
Py_MONITORING_H
#define
Py_MONITORING_H
#ifndef
Py_LIMITED_API
#ifdef
__cplusplus
extern
"C"
{
#endif
// There is currently no limited API for monitoring
/* Local events.
* These require bytecode instrumentation */
#define
PY_MONITORING_EVENT_PY_START
0
#define
PY_MONITORING_EVENT_PY_RESUME
1
#define
PY_MONITORING_EVENT_PY_RETURN
2
#define
PY_MONITORING_EVENT_PY_YIELD
3
#define
PY_MONITORING_EVENT_CALL
4
#define
PY_MONITORING_EVENT_LINE
5
#define
PY_MONITORING_EVENT_INSTRUCTION
6
#define
PY_MONITORING_EVENT_JUMP
7
#define
PY_MONITORING_EVENT_BRANCH_LEFT
8
#define
PY_MONITORING_EVENT_BRANCH_RIGHT
9
#define
PY_MONITORING_EVENT_STOP_ITERATION
10
#define
PY_MONITORING_IS_INSTRUMENTED_EVENT
(
ev
) \
((ev) <= PY_MONITORING_EVENT_STOP_ITERATION)
/* Other events, mainly exceptions.
* These can now be turned on and disabled on a per code object basis. */
#define
PY_MONITORING_EVENT_RAISE
11
#define
PY_MONITORING_EVENT_EXCEPTION_HANDLED
12
#define
PY_MONITORING_EVENT_PY_UNWIND
13
#define
PY_MONITORING_EVENT_PY_THROW
14
#define
PY_MONITORING_EVENT_RERAISE
15
#define
_PY_MONITORING_IS_UNGROUPED_EVENT
(
ev
) \
((ev) < _PY_MONITORING_UNGROUPED_EVENTS)
/* Ancillary events */
#define
PY_MONITORING_EVENT_C_RETURN
16
#define
PY_MONITORING_EVENT_C_RAISE
17
#define
PY_MONITORING_EVENT_BRANCH
18
typedef
struct
_PyMonitoringState
{
uint8_t
active
;
uint8_t
opaque
;
}
PyMonitoringState
;
PyAPI_FUNC
(
int
)
PyMonitoring_EnterScope
(
PyMonitoringState
*
state_array
,
uint64_t
*
version
,
const
uint8_t
*
event_types
,
Py_ssize_t
length
);
PyAPI_FUNC
(
int
)
PyMonitoring_ExitScope
(
void
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FirePyStartEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FirePyResumeEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FirePyReturnEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
retval
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FirePyYieldEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
retval
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireCallEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
callable
,
PyObject
*
arg0
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireLineEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
int
lineno
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireJumpEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
);
Py_DEPRECATED
(
3.14
)
PyAPI_FUNC
(
int
)
_PyMonitoring_FireBranchEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireBranchRightEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireBranchLeftEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireCReturnEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
retval
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FirePyThrowEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireRaiseEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireReraiseEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireExceptionHandledEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireCRaiseEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FirePyUnwindEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
);
PyAPI_FUNC
(
int
)
_PyMonitoring_FireStopIterationEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
value
);
#define
_PYMONITORING_IF_ACTIVE
(
STATE
,
X
) \
if ((STATE)->active) { \
return (X); \
} \
else { \
return 0; \
}
static
inline
int
PyMonitoring_FirePyStartEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FirePyStartEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FirePyResumeEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FirePyResumeEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FirePyReturnEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
retval
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FirePyReturnEvent
(
state
,
codelike
,
offset
,
retval
));
}
static
inline
int
PyMonitoring_FirePyYieldEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
retval
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FirePyYieldEvent
(
state
,
codelike
,
offset
,
retval
));
}
static
inline
int
PyMonitoring_FireCallEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
callable
,
PyObject
*
arg0
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireCallEvent
(
state
,
codelike
,
offset
,
callable
,
arg0
));
}
static
inline
int
PyMonitoring_FireLineEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
int
lineno
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireLineEvent
(
state
,
codelike
,
offset
,
lineno
));
}
static
inline
int
PyMonitoring_FireJumpEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireJumpEvent
(
state
,
codelike
,
offset
,
target_offset
));
}
static
inline
int
PyMonitoring_FireBranchRightEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireBranchRightEvent
(
state
,
codelike
,
offset
,
target_offset
));
}
static
inline
int
PyMonitoring_FireBranchLeftEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
target_offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireBranchLeftEvent
(
state
,
codelike
,
offset
,
target_offset
));
}
static
inline
int
PyMonitoring_FireCReturnEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
retval
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireCReturnEvent
(
state
,
codelike
,
offset
,
retval
));
}
static
inline
int
PyMonitoring_FirePyThrowEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FirePyThrowEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FireRaiseEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireRaiseEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FireReraiseEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireReraiseEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FireExceptionHandledEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireExceptionHandledEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FireCRaiseEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireCRaiseEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FirePyUnwindEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FirePyUnwindEvent
(
state
,
codelike
,
offset
));
}
static
inline
int
PyMonitoring_FireStopIterationEvent
(
PyMonitoringState
*
state
,
PyObject
*
codelike
,
int32_t
offset
,
PyObject
*
value
)
{
_PYMONITORING_IF_ACTIVE
(
state
,
_PyMonitoring_FireStopIterationEvent
(
state
,
codelike
,
offset
,
value
));
}
#undef
_PYMONITORING_IF_ACTIVE
#ifdef
__cplusplus
}
#endif
#endif
// !Py_LIMITED_API
#endif
// !Py_MONITORING_H
Footer
© 2026 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Community
Docs
Contact
Manage cookies
Do not share my personal information
You cant perform that action at this time.
Web Proxy Viewer |
New URL
|
Original Page