MCPcopy Index your code
hub / github.com/RustPython/RustPython / events_for_code

Method events_for_code

crates/vm/src/stdlib/sys/monitoring.rs:127–135  ·  view source on GitHub ↗

Compute the events that apply to a specific code object: global events OR'd with local events registered for that code. This prevents events like INSTRUCTION that are local to one code from being applied to unrelated code objects.

(&self, code_id: usize)

Source from the content-addressed store, hash-verified

125 /// This prevents events like INSTRUCTION that are local to one code
126 /// from being applied to unrelated code objects.
127 pub fn events_for_code(&self, code_id: usize) -> u32 {
128 let global = self.global_events.iter().fold(0, |acc, &e| acc | e);
129 let local = self
130 .local_events
131 .iter()
132 .filter(|((_, cid), _)| *cid == code_id)
133 .fold(0, |acc, (_, &e)| acc | e);
134 global | local
135 }
136}
137
138/// Global atomic mask: OR of all tools' events. Checked in the hot path

Callers 3

execute_instructionMethod · 0.80
execute_instrumentedMethod · 0.80
update_events_maskFunction · 0.80

Calls 3

foldMethod · 0.45
iterMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected