diff options
Diffstat (limited to 'embassy-executor/src/raw/trace.rs')
| -rw-r--r-- | embassy-executor/src/raw/trace.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/embassy-executor/src/raw/trace.rs b/embassy-executor/src/raw/trace.rs index c7bcf9c11..b34387b58 100644 --- a/embassy-executor/src/raw/trace.rs +++ b/embassy-executor/src/raw/trace.rs | |||
| @@ -61,29 +61,23 @@ pub(crate) fn executor_idle(executor: &SyncExecutor) { | |||
| 61 | rtos_trace::trace::system_idle(); | 61 | rtos_trace::trace::system_idle(); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | #[cfg(all(feature = "rtos-trace", feature = "integrated-timers"))] | ||
| 65 | const fn gcd(a: u64, b: u64) -> u64 { | ||
| 66 | if b == 0 { | ||
| 67 | a | ||
| 68 | } else { | ||
| 69 | gcd(b, a % b) | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | #[cfg(feature = "rtos-trace")] | 64 | #[cfg(feature = "rtos-trace")] |
| 74 | impl rtos_trace::RtosTraceOSCallbacks for crate::raw::SyncExecutor { | 65 | impl rtos_trace::RtosTraceOSCallbacks for crate::raw::SyncExecutor { |
| 75 | fn task_list() { | 66 | fn task_list() { |
| 76 | // We don't know what tasks exist, so we can't send them. | 67 | // We don't know what tasks exist, so we can't send them. |
| 77 | } | 68 | } |
| 78 | #[cfg(feature = "integrated-timers")] | ||
| 79 | fn time() -> u64 { | 69 | fn time() -> u64 { |
| 70 | const fn gcd(a: u64, b: u64) -> u64 { | ||
| 71 | if b == 0 { | ||
| 72 | a | ||
| 73 | } else { | ||
| 74 | gcd(b, a % b) | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 80 | const GCD_1M: u64 = gcd(embassy_time_driver::TICK_HZ, 1_000_000); | 78 | const GCD_1M: u64 = gcd(embassy_time_driver::TICK_HZ, 1_000_000); |
| 81 | embassy_time_driver::now() * (1_000_000 / GCD_1M) / (embassy_time_driver::TICK_HZ / GCD_1M) | 79 | embassy_time_driver::now() * (1_000_000 / GCD_1M) / (embassy_time_driver::TICK_HZ / GCD_1M) |
| 82 | } | 80 | } |
| 83 | #[cfg(not(feature = "integrated-timers"))] | ||
| 84 | fn time() -> u64 { | ||
| 85 | 0 | ||
| 86 | } | ||
| 87 | } | 81 | } |
| 88 | 82 | ||
| 89 | #[cfg(feature = "rtos-trace")] | 83 | #[cfg(feature = "rtos-trace")] |
