MCPcopy Create free account
hub / github.com/hashintel/hash / ll_drop

Function ll_drop

libs/darwin-kperf/src/sampler/ll.rs:219–231  ·  view source on GitHub ↗

Tears down the sampler: restores the previous `force_all` state and frees the PMC database.

(sampler: &Sampler)

Source from the content-addressed store, hash-verified

217/// Tears down the sampler: restores the previous `force_all` state and frees
218/// the PMC database.
219pub(crate) fn ll_drop(sampler: &Sampler) {
220 let kpc_vt = sampler.kperf.vtable();
221 let kpep_vt = sampler.kperfdata.vtable();
222
223 // SAFETY: restores the force_all_ctrs value saved at init.
224 let _result = unsafe { (kpc_vt.kpc_force_all_ctrs_set)(sampler.saved_force_all) };
225
226 // SAFETY: db was allocated by kpep_db_create and has not been freed.
227 // The kperfdata framework is still loaded (Sampler owns it).
228 unsafe {
229 (kpep_vt.kpep_db_free)(sampler.db.as_ptr());
230 }
231}
232
233/// Verifies the runtime `kpep_event` stride matches `size_of::<kpep_event>()`.
234///

Callers 1

dropMethod · 0.85

Calls 1

vtableMethod · 0.80

Tested by

no test coverage detected