MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / attach_libcpp_probes

Method attach_libcpp_probes

crates/memtrack/src/ebpf/memtrack.rs:370–385  ·  view source on GitHub ↗

Attach C++ operator new/delete probes. These are mangled C++ symbols that wrap the underlying allocator. C++ operators have identical signatures to malloc/free, so we reuse those handlers.

(&mut self, lib_path: &Path)

Source from the content-addressed store, hash-verified

368 /// These are mangled C++ symbols that wrap the underlying allocator.
369 /// C++ operators have identical signatures to malloc/free, so we reuse those handlers.
370 fn attach_libcpp_probes(&mut self, lib_path: &Path) -> Result<()> {
371 self.try_attach_malloc(lib_path, "_Znwm"); // operator new(size_t)
372 self.try_attach_malloc(lib_path, "_Znam"); // operator new[](size_t)
373 self.try_attach_malloc(lib_path, "_ZnwmSt11align_val_t"); // operator new(size_t, std::align_val_t)
374 self.try_attach_malloc(lib_path, "_ZnamSt11align_val_t"); // operator new[](size_t, std::align_val_t)
375 self.try_attach_free(lib_path, "_ZdlPv"); // operator delete(void*)
376 self.try_attach_free(lib_path, "_ZdaPv"); // operator delete[](void*)
377 self.try_attach_free(lib_path, "_ZdlPvm"); // operator delete(void*, size_t) - C++14 sized delete
378 self.try_attach_free(lib_path, "_ZdaPvm"); // operator delete[](void*, size_t) - C++14 sized delete
379 self.try_attach_free(lib_path, "_ZdlPvSt11align_val_t"); // operator delete(void*, std::align_val_t)
380 self.try_attach_free(lib_path, "_ZdaPvSt11align_val_t"); // operator delete[](void*, std::align_val_t)
381 self.try_attach_free(lib_path, "_ZdlPvmSt11align_val_t"); // operator delete(void*, size_t, std::align_val_t)
382 self.try_attach_free(lib_path, "_ZdaPvmSt11align_val_t"); // operator delete[](void*, size_t, std::align_val_t)
383
384 Ok(())
385 }
386
387 /// Attach jemalloc-specific probes (prefixed and extended API).
388 fn attach_jemalloc_probes(&mut self, lib_path: &Path) -> Result<()> {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected