Tears down the sampler: restores the previous `force_all` state and frees the PMC database.
(sampler: &Sampler)
| 217 | /// Tears down the sampler: restores the previous `force_all` state and frees |
| 218 | /// the PMC database. |
| 219 | pub(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 | /// |