From 5e9564f728f6a7b85007489c2761b3873a7f932d Mon Sep 17 00:00:00 2001 From: Vlad Scherbich Date: Thu, 18 Jun 2026 08:50:31 -0400 Subject: [PATCH] feat(profiling): add OffCpuTime and OffCpuSamples sample types --- libdd-profiling/src/api/sample_type.rs | 7 +++++++ libdd-profiling/src/cxx.rs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/libdd-profiling/src/api/sample_type.rs b/libdd-profiling/src/api/sample_type.rs index 4e1156b4bb..cebf550695 100644 --- a/libdd-profiling/src/api/sample_type.rs +++ b/libdd-profiling/src/api/sample_type.rs @@ -75,6 +75,9 @@ pub enum SampleType { /// Legacy: Use `WallTime` instead for consistency with naming scheme WallLegacy, + OffCpuSamples, + OffCpuTime, + // Experimental sample types for testing and development. ExperimentalCount, ExperimentalNanoseconds, @@ -160,6 +163,8 @@ impl From for ValueType<'static> { SampleType::WallSamples => ValueType::new("wall-samples", "count"), SampleType::WallTime => ValueType::new("wall-time", "nanoseconds"), SampleType::WallLegacy => ValueType::new("wall", "nanoseconds"), + SampleType::OffCpuSamples => ValueType::new("off-cpu-samples", "count"), + SampleType::OffCpuTime => ValueType::new("off-cpu-time", "nanoseconds"), SampleType::ExperimentalCount => ValueType::new("experimental-count", "count"), SampleType::ExperimentalNanoseconds => { ValueType::new("experimental-nanoseconds", "nanoseconds") @@ -226,6 +231,8 @@ impl<'a> TryFrom> for SampleType { ("wall-samples", "count") => SampleType::WallSamples, ("wall-time", "nanoseconds") => SampleType::WallTime, ("wall", "nanoseconds") => SampleType::WallLegacy, + ("off-cpu-samples", "count") => SampleType::OffCpuSamples, + ("off-cpu-time", "nanoseconds") => SampleType::OffCpuTime, ("experimental-count", "count") => SampleType::ExperimentalCount, ("experimental-nanoseconds", "nanoseconds") => SampleType::ExperimentalNanoseconds, ("experimental-bytes", "bytes") => SampleType::ExperimentalBytes, diff --git a/libdd-profiling/src/cxx.rs b/libdd-profiling/src/cxx.rs index 312b1c636d..396c026320 100644 --- a/libdd-profiling/src/cxx.rs +++ b/libdd-profiling/src/cxx.rs @@ -89,6 +89,8 @@ pub mod ffi { WallSamples, WallTime, WallLegacy, // LEGACY: Use WallTime instead + OffCpuSamples, + OffCpuTime, ExperimentalCount, ExperimentalNanoseconds, ExperimentalBytes, @@ -391,6 +393,8 @@ impl TryFrom for api::SampleType { ffi::SampleType::WallSamples => api::SampleType::WallSamples, ffi::SampleType::WallTime => api::SampleType::WallTime, ffi::SampleType::WallLegacy => api::SampleType::WallLegacy, + ffi::SampleType::OffCpuSamples => api::SampleType::OffCpuSamples, + ffi::SampleType::OffCpuTime => api::SampleType::OffCpuTime, ffi::SampleType::ExperimentalCount => api::SampleType::ExperimentalCount, ffi::SampleType::ExperimentalNanoseconds => api::SampleType::ExperimentalNanoseconds, ffi::SampleType::ExperimentalBytes => api::SampleType::ExperimentalBytes,