aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/raw/trace.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-12-09 00:28:14 +0100
committerDániel Buga <[email protected]>2024-12-15 18:49:57 +0100
commit2f2e2c6031a1abaecdac5ed2febe109e647fe6fd (patch)
tree57ecbf9d7c0ab5e9439f12aedeaa58d0156d1605 /embassy-executor/src/raw/trace.rs
parentb268b1795fed58544c166c41842ce0d66328aa3e (diff)
Make `integrated-timers` the default, remove Cargo feature.
Diffstat (limited to 'embassy-executor/src/raw/trace.rs')
-rw-r--r--embassy-executor/src/raw/trace.rs22
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"))]
65const 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")]
74impl rtos_trace::RtosTraceOSCallbacks for crate::raw::SyncExecutor { 65impl 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")]