@@ -138,7 +138,7 @@ is_instrumented(int opcode)
138
138
static inline bool
139
139
monitors_equals (_Py_Monitors a , _Py_Monitors b )
140
140
{
141
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
141
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
142
142
if (a .tools [i ] != b .tools [i ]) {
143
143
return false;
144
144
}
@@ -151,7 +151,7 @@ static inline _Py_Monitors
151
151
monitors_sub (_Py_Monitors a , _Py_Monitors b )
152
152
{
153
153
_Py_Monitors res ;
154
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
154
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
155
155
res .tools [i ] = a .tools [i ] & ~b .tools [i ];
156
156
}
157
157
return res ;
@@ -162,7 +162,7 @@ static inline _Py_Monitors
162
162
monitors_and (_Py_Monitors a , _Py_Monitors b )
163
163
{
164
164
_Py_Monitors res ;
165
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
165
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
166
166
res .tools [i ] = a .tools [i ] & b .tools [i ];
167
167
}
168
168
return res ;
@@ -173,7 +173,7 @@ static inline _Py_Monitors
173
173
monitors_or (_Py_Monitors a , _Py_Monitors b )
174
174
{
175
175
_Py_Monitors res ;
176
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
176
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
177
177
res .tools [i ] = a .tools [i ] | b .tools [i ];
178
178
}
179
179
return res ;
@@ -182,7 +182,7 @@ monitors_or(_Py_Monitors a, _Py_Monitors b)
182
182
static inline bool
183
183
monitors_are_empty (_Py_Monitors m )
184
184
{
185
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
185
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
186
186
if (m .tools [i ]) {
187
187
return false;
188
188
}
@@ -193,7 +193,7 @@ monitors_are_empty(_Py_Monitors m)
193
193
static inline bool
194
194
multiple_tools (_Py_Monitors * m )
195
195
{
196
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
196
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
197
197
if (_Py_popcount32 (m -> tools [i ]) > 1 ) {
198
198
return true;
199
199
}
@@ -205,7 +205,7 @@ static inline _PyMonitoringEventSet
205
205
get_events (_Py_Monitors * m , int tool_id )
206
206
{
207
207
_PyMonitoringEventSet result = 0 ;
208
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
208
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
209
209
if ((m -> tools [e ] >> tool_id ) & 1 ) {
210
210
result |= (1 << e );
211
211
}
@@ -340,7 +340,7 @@ static void
340
340
dump_monitors (const char * prefix , _Py_Monitors monitors , FILE * out )
341
341
{
342
342
fprintf (out , "%s monitors:\n" , prefix );
343
- for (int event = 0 ; event < PY_MONITORING_UNGROUPED_EVENTS ; event ++ ) {
343
+ for (int event = 0 ; event < _PY_MONITORING_UNGROUPED_EVENTS ; event ++ ) {
344
344
fprintf (out , " Event %d: Tools %x\n" , event , monitors .tools [event ]);
345
345
}
346
346
}
@@ -910,7 +910,7 @@ get_tools_for_instruction(PyCodeObject * code, int i, int event)
910
910
assert (event != PY_MONITORING_EVENT_INSTRUCTION );
911
911
assert (instrumentation_cross_checks (PyThreadState_GET ()-> interp , code ));
912
912
_PyCoMonitoringData * monitoring = code -> _co_monitoring ;
913
- if (event >= PY_MONITORING_UNGROUPED_EVENTS ) {
913
+ if (event >= _PY_MONITORING_UNGROUPED_EVENTS ) {
914
914
assert (event == PY_MONITORING_EVENT_C_RAISE ||
915
915
event == PY_MONITORING_EVENT_C_RETURN );
916
916
event = PY_MONITORING_EVENT_CALL ;
@@ -1216,7 +1216,7 @@ _PyMonitoring_RegisterCallback(int tool_id, int event_id, PyObject *obj)
1216
1216
{
1217
1217
PyInterpreterState * is = _PyInterpreterState_Get ();
1218
1218
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1219
- assert (0 <= event_id && event_id < PY_MONITORING_EVENTS );
1219
+ assert (0 <= event_id && event_id < _PY_MONITORING_EVENTS );
1220
1220
PyObject * callback = is -> monitoring_callables [tool_id ][event_id ];
1221
1221
is -> monitoring_callables [tool_id ][event_id ] = Py_XNewRef (obj );
1222
1222
return callback ;
@@ -1667,7 +1667,7 @@ static void
1667
1667
set_events (_Py_Monitors * m , int tool_id , _PyMonitoringEventSet events )
1668
1668
{
1669
1669
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1670
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1670
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1671
1671
uint8_t * tools = & m -> tools [e ];
1672
1672
int val = (events >> e ) & 1 ;
1673
1673
* tools &= ~(1 << tool_id );
@@ -1692,7 +1692,7 @@ _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events)
1692
1692
{
1693
1693
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1694
1694
PyInterpreterState * interp = _PyInterpreterState_Get ();
1695
- assert (events < (1 << PY_MONITORING_UNGROUPED_EVENTS ));
1695
+ assert (events < (1 << _PY_MONITORING_UNGROUPED_EVENTS ));
1696
1696
if (check_tool (interp , tool_id )) {
1697
1697
return -1 ;
1698
1698
}
@@ -1710,7 +1710,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
1710
1710
{
1711
1711
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1712
1712
PyInterpreterState * interp = _PyInterpreterState_Get ();
1713
- assert (events < (1 << PY_MONITORING_UNGROUPED_EVENTS ));
1713
+ assert (events < (1 << _PY_MONITORING_UNGROUPED_EVENTS ));
1714
1714
if (check_tool (interp , tool_id )) {
1715
1715
return -1 ;
1716
1716
}
@@ -1849,7 +1849,7 @@ monitoring_register_callback_impl(PyObject *module, int tool_id, int event,
1849
1849
return NULL ;
1850
1850
}
1851
1851
int event_id = _Py_bit_length (event )- 1 ;
1852
- if (event_id < 0 || event_id >= PY_MONITORING_EVENTS ) {
1852
+ if (event_id < 0 || event_id >= _PY_MONITORING_EVENTS ) {
1853
1853
PyErr_Format (PyExc_ValueError , "invalid event %d" , event );
1854
1854
return NULL ;
1855
1855
}
@@ -1899,7 +1899,7 @@ monitoring_set_events_impl(PyObject *module, int tool_id, int event_set)
1899
1899
if (check_valid_tool (tool_id )) {
1900
1900
return NULL ;
1901
1901
}
1902
- if (event_set < 0 || event_set >= (1 << PY_MONITORING_EVENTS )) {
1902
+ if (event_set < 0 || event_set >= (1 << _PY_MONITORING_EVENTS )) {
1903
1903
PyErr_Format (PyExc_ValueError , "invalid event set 0x%x" , event_set );
1904
1904
return NULL ;
1905
1905
}
@@ -1941,7 +1941,7 @@ monitoring_get_local_events_impl(PyObject *module, int tool_id,
1941
1941
_PyMonitoringEventSet event_set = 0 ;
1942
1942
_PyCoMonitoringData * data = ((PyCodeObject * )code )-> _co_monitoring ;
1943
1943
if (data != NULL ) {
1944
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1944
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1945
1945
if ((data -> local_monitors .tools [e ] >> tool_id ) & 1 ) {
1946
1946
event_set |= (1 << e );
1947
1947
}
@@ -1975,7 +1975,7 @@ monitoring_set_local_events_impl(PyObject *module, int tool_id,
1975
1975
if (check_valid_tool (tool_id )) {
1976
1976
return NULL ;
1977
1977
}
1978
- if (event_set < 0 || event_set >= (1 << PY_MONITORING_EVENTS )) {
1978
+ if (event_set < 0 || event_set >= (1 << _PY_MONITORING_EVENTS )) {
1979
1979
PyErr_Format (PyExc_ValueError , "invalid event set 0x%x" , event_set );
1980
1980
return NULL ;
1981
1981
}
@@ -2056,7 +2056,7 @@ monitoring__all_events_impl(PyObject *module)
2056
2056
if (res == NULL ) {
2057
2057
return NULL ;
2058
2058
}
2059
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
2059
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
2060
2060
uint8_t tools = interp -> monitors .tools [e ];
2061
2061
if (tools == 0 ) {
2062
2062
continue ;
@@ -2115,7 +2115,7 @@ PyObject *_Py_CreateMonitoringObject(void)
2115
2115
if (err ) {
2116
2116
goto error ;
2117
2117
}
2118
- for (int i = 0 ; i < PY_MONITORING_EVENTS ; i ++ ) {
2118
+ for (int i = 0 ; i < _PY_MONITORING_EVENTS ; i ++ ) {
2119
2119
if (add_power2_constant (events , event_names [i ], i )) {
2120
2120
goto error ;
2121
2121
}
0 commit comments