diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-07-08 23:29:31 +0200 |
|---|---|---|
| committer | diondokter <[email protected]> | 2025-08-29 13:20:18 +0200 |
| commit | 658a52fb99e47d3d2f08ebf66335774930ad35ac (patch) | |
| tree | 6e8f84b45f6a8de168c1eaccf5917af7b8fca991 /embassy-executor/src/raw | |
| parent | d3c84ee1d34329e61464c9acbedab74e9076ac0d (diff) | |
executor: do not store task IDs in RAM, we can get it from the pointer every time.
Diffstat (limited to 'embassy-executor/src/raw')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 10 | ||||
| -rw-r--r-- | embassy-executor/src/raw/trace.rs | 17 |
2 files changed, 6 insertions, 21 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 4b17d4982..bcd4ee432 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -97,8 +97,6 @@ pub(crate) struct TaskHeader { | |||
| 97 | #[cfg(feature = "trace")] | 97 | #[cfg(feature = "trace")] |
| 98 | pub(crate) name: Option<&'static str>, | 98 | pub(crate) name: Option<&'static str>, |
| 99 | #[cfg(feature = "trace")] | 99 | #[cfg(feature = "trace")] |
| 100 | pub(crate) id: u32, | ||
| 101 | #[cfg(feature = "trace")] | ||
| 102 | all_tasks_next: AtomicPtr<TaskHeader>, | 100 | all_tasks_next: AtomicPtr<TaskHeader>, |
| 103 | } | 101 | } |
| 104 | 102 | ||
| @@ -148,6 +146,12 @@ impl TaskRef { | |||
| 148 | pub(crate) fn as_ptr(self) -> *const TaskHeader { | 146 | pub(crate) fn as_ptr(self) -> *const TaskHeader { |
| 149 | self.ptr.as_ptr() | 147 | self.ptr.as_ptr() |
| 150 | } | 148 | } |
| 149 | |||
| 150 | /// Returns the task ID. | ||
| 151 | /// This can be used in combination with rtos-trace to match task names with IDs | ||
| 152 | pub fn id(&self) -> u32 { | ||
| 153 | self.as_ptr() as u32 | ||
| 154 | } | ||
| 151 | } | 155 | } |
| 152 | 156 | ||
| 153 | /// Raw storage in which a task can be spawned. | 157 | /// Raw storage in which a task can be spawned. |
| @@ -192,8 +196,6 @@ impl<F: Future + 'static> TaskStorage<F> { | |||
| 192 | #[cfg(feature = "trace")] | 196 | #[cfg(feature = "trace")] |
| 193 | name: None, | 197 | name: None, |
| 194 | #[cfg(feature = "trace")] | 198 | #[cfg(feature = "trace")] |
| 195 | id: 0, | ||
| 196 | #[cfg(feature = "trace")] | ||
| 197 | all_tasks_next: AtomicPtr::new(core::ptr::null_mut()), | 199 | all_tasks_next: AtomicPtr::new(core::ptr::null_mut()), |
| 198 | }, | 200 | }, |
| 199 | future: UninitCell::uninit(), | 201 | future: UninitCell::uninit(), |
diff --git a/embassy-executor/src/raw/trace.rs b/embassy-executor/src/raw/trace.rs index f484abf58..e769d63da 100644 --- a/embassy-executor/src/raw/trace.rs +++ b/embassy-executor/src/raw/trace.rs | |||
| @@ -176,12 +176,6 @@ pub trait TaskRefTrace { | |||
| 176 | 176 | ||
| 177 | /// Set the name for a task | 177 | /// Set the name for a task |
| 178 | fn set_name(&self, name: Option<&'static str>); | 178 | fn set_name(&self, name: Option<&'static str>); |
| 179 | |||
| 180 | /// Get the ID for a task | ||
| 181 | fn id(&self) -> u32; | ||
| 182 | |||
| 183 | /// Set the ID for a task | ||
| 184 | fn set_id(&self, id: u32); | ||
| 185 | } | 179 | } |
| 186 | 180 | ||
| 187 | impl TaskRefTrace for TaskRef { | 181 | impl TaskRefTrace for TaskRef { |
| @@ -195,17 +189,6 @@ impl TaskRefTrace for TaskRef { | |||
| 195 | (*header_ptr).name = name; | 189 | (*header_ptr).name = name; |
| 196 | } | 190 | } |
| 197 | } | 191 | } |
| 198 | |||
| 199 | fn id(&self) -> u32 { | ||
| 200 | self.header().id | ||
| 201 | } | ||
| 202 | |||
| 203 | fn set_id(&self, id: u32) { | ||
| 204 | unsafe { | ||
| 205 | let header_ptr = self.ptr.as_ptr() as *mut TaskHeader; | ||
| 206 | (*header_ptr).id = id; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | } | 192 | } |
| 210 | 193 | ||
| 211 | #[cfg(not(feature = "rtos-trace"))] | 194 | #[cfg(not(feature = "rtos-trace"))] |
