@@ -137,7 +137,7 @@ is_instrumented(int opcode)
137
137
static inline bool
138
138
monitors_equals (_Py_Monitors a , _Py_Monitors b )
139
139
{
140
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
140
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
141
141
if (a .tools [i ] != b .tools [i ]) {
142
142
return false;
143
143
}
@@ -150,7 +150,7 @@ static inline _Py_Monitors
150
150
monitors_sub (_Py_Monitors a , _Py_Monitors b )
151
151
{
152
152
_Py_Monitors res ;
153
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
153
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
154
154
res .tools [i ] = a .tools [i ] & ~b .tools [i ];
155
155
}
156
156
return res ;
@@ -161,7 +161,7 @@ static inline _Py_Monitors
161
161
monitors_and (_Py_Monitors a , _Py_Monitors b )
162
162
{
163
163
_Py_Monitors res ;
164
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
164
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
165
165
res .tools [i ] = a .tools [i ] & b .tools [i ];
166
166
}
167
167
return res ;
@@ -172,7 +172,7 @@ static inline _Py_Monitors
172
172
monitors_or (_Py_Monitors a , _Py_Monitors b )
173
173
{
174
174
_Py_Monitors res ;
175
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
175
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
176
176
res .tools [i ] = a .tools [i ] | b .tools [i ];
177
177
}
178
178
return res ;
@@ -181,7 +181,7 @@ monitors_or(_Py_Monitors a, _Py_Monitors b)
181
181
static inline bool
182
182
monitors_are_empty (_Py_Monitors m )
183
183
{
184
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
184
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
185
185
if (m .tools [i ]) {
186
186
return false;
187
187
}
@@ -192,7 +192,7 @@ monitors_are_empty(_Py_Monitors m)
192
192
static inline bool
193
193
multiple_tools (_Py_Monitors * m )
194
194
{
195
- for (int i = 0 ; i < PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
195
+ for (int i = 0 ; i < _PY_MONITORING_UNGROUPED_EVENTS ; i ++ ) {
196
196
if (_Py_popcount32 (m -> tools [i ]) > 1 ) {
197
197
return true;
198
198
}
@@ -204,7 +204,7 @@ static inline _PyMonitoringEventSet
204
204
get_events (_Py_Monitors * m , int tool_id )
205
205
{
206
206
_PyMonitoringEventSet result = 0 ;
207
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
207
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
208
208
if ((m -> tools [e ] >> tool_id ) & 1 ) {
209
209
result |= (1 << e );
210
210
}
@@ -339,7 +339,7 @@ static void
339
339
dump_monitors (const char * prefix , _Py_Monitors monitors , FILE * out )
340
340
{
341
341
fprintf (out , "%s monitors:\n" , prefix );
342
- for (int event = 0 ; event < PY_MONITORING_UNGROUPED_EVENTS ; event ++ ) {
342
+ for (int event = 0 ; event < _PY_MONITORING_UNGROUPED_EVENTS ; event ++ ) {
343
343
fprintf (out , " Event %d: Tools %x\n" , event , monitors .tools [event ]);
344
344
}
345
345
}
@@ -907,7 +907,7 @@ get_tools_for_instruction(PyCodeObject *code, PyInterpreterState *interp, int i,
907
907
uint8_t tools ;
908
908
assert (event != PY_MONITORING_EVENT_LINE );
909
909
assert (event != PY_MONITORING_EVENT_INSTRUCTION );
910
- if (event >= PY_MONITORING_UNGROUPED_EVENTS ) {
910
+ if (event >= _PY_MONITORING_UNGROUPED_EVENTS ) {
911
911
assert (event == PY_MONITORING_EVENT_C_RAISE ||
912
912
event == PY_MONITORING_EVENT_C_RETURN );
913
913
event = PY_MONITORING_EVENT_CALL ;
@@ -1220,7 +1220,7 @@ _PyMonitoring_RegisterCallback(int tool_id, int event_id, PyObject *obj)
1220
1220
{
1221
1221
PyInterpreterState * is = _PyInterpreterState_GET ();
1222
1222
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1223
- assert (0 <= event_id && event_id < PY_MONITORING_EVENTS );
1223
+ assert (0 <= event_id && event_id < _PY_MONITORING_EVENTS );
1224
1224
PyObject * callback = is -> monitoring_callables [tool_id ][event_id ];
1225
1225
is -> monitoring_callables [tool_id ][event_id ] = Py_XNewRef (obj );
1226
1226
return callback ;
@@ -1653,7 +1653,7 @@ static void
1653
1653
set_events (_Py_Monitors * m , int tool_id , _PyMonitoringEventSet events )
1654
1654
{
1655
1655
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1656
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1656
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1657
1657
uint8_t * tools = & m -> tools [e ];
1658
1658
int val = (events >> e ) & 1 ;
1659
1659
* tools &= ~(1 << tool_id );
@@ -1678,7 +1678,7 @@ _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events)
1678
1678
{
1679
1679
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1680
1680
PyInterpreterState * interp = _PyInterpreterState_GET ();
1681
- assert (events < (1 << PY_MONITORING_UNGROUPED_EVENTS ));
1681
+ assert (events < (1 << _PY_MONITORING_UNGROUPED_EVENTS ));
1682
1682
if (check_tool (interp , tool_id )) {
1683
1683
return -1 ;
1684
1684
}
@@ -1696,7 +1696,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
1696
1696
{
1697
1697
assert (0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS );
1698
1698
PyInterpreterState * interp = _PyInterpreterState_GET ();
1699
- assert (events < (1 << PY_MONITORING_UNGROUPED_EVENTS ));
1699
+ assert (events < (1 << _PY_MONITORING_UNGROUPED_EVENTS ));
1700
1700
if (check_tool (interp , tool_id )) {
1701
1701
return -1 ;
1702
1702
}
@@ -1835,7 +1835,7 @@ monitoring_register_callback_impl(PyObject *module, int tool_id, int event,
1835
1835
return NULL ;
1836
1836
}
1837
1837
int event_id = _Py_bit_length (event )- 1 ;
1838
- if (event_id < 0 || event_id >= PY_MONITORING_EVENTS ) {
1838
+ if (event_id < 0 || event_id >= _PY_MONITORING_EVENTS ) {
1839
1839
PyErr_Format (PyExc_ValueError , "invalid event %d" , event );
1840
1840
return NULL ;
1841
1841
}
@@ -1885,7 +1885,7 @@ monitoring_set_events_impl(PyObject *module, int tool_id, int event_set)
1885
1885
if (check_valid_tool (tool_id )) {
1886
1886
return NULL ;
1887
1887
}
1888
- if (event_set < 0 || event_set >= (1 << PY_MONITORING_EVENTS )) {
1888
+ if (event_set < 0 || event_set >= (1 << _PY_MONITORING_EVENTS )) {
1889
1889
PyErr_Format (PyExc_ValueError , "invalid event set 0x%x" , event_set );
1890
1890
return NULL ;
1891
1891
}
@@ -1927,7 +1927,7 @@ monitoring_get_local_events_impl(PyObject *module, int tool_id,
1927
1927
_PyMonitoringEventSet event_set = 0 ;
1928
1928
_PyCoMonitoringData * data = ((PyCodeObject * )code )-> _co_monitoring ;
1929
1929
if (data != NULL ) {
1930
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1930
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
1931
1931
if ((data -> local_monitors .tools [e ] >> tool_id ) & 1 ) {
1932
1932
event_set |= (1 << e );
1933
1933
}
@@ -1961,7 +1961,7 @@ monitoring_set_local_events_impl(PyObject *module, int tool_id,
1961
1961
if (check_valid_tool (tool_id )) {
1962
1962
return NULL ;
1963
1963
}
1964
- if (event_set < 0 || event_set >= (1 << PY_MONITORING_EVENTS )) {
1964
+ if (event_set < 0 || event_set >= (1 << _PY_MONITORING_EVENTS )) {
1965
1965
PyErr_Format (PyExc_ValueError , "invalid event set 0x%x" , event_set );
1966
1966
return NULL ;
1967
1967
}
@@ -2042,7 +2042,7 @@ monitoring__all_events_impl(PyObject *module)
2042
2042
if (res == NULL ) {
2043
2043
return NULL ;
2044
2044
}
2045
- for (int e = 0 ; e < PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
2045
+ for (int e = 0 ; e < _PY_MONITORING_UNGROUPED_EVENTS ; e ++ ) {
2046
2046
uint8_t tools = interp -> monitors .tools [e ];
2047
2047
if (tools == 0 ) {
2048
2048
continue ;
@@ -2101,7 +2101,7 @@ PyObject *_Py_CreateMonitoringObject(void)
2101
2101
if (err ) {
2102
2102
goto error ;
2103
2103
}
2104
- for (int i = 0 ; i < PY_MONITORING_EVENTS ; i ++ ) {
2104
+ for (int i = 0 ; i < _PY_MONITORING_EVENTS ; i ++ ) {
2105
2105
if (add_power2_constant (events , event_names [i ], i )) {
2106
2106
goto error ;
2107
2107
}
0 commit comments