Skip to content

Investigate having timeout code track tick deadlines instead of deltas #2811

@zephyrbot

Description

@zephyrbot

Reported by Allan Stephens:

Currently the kernel maintains a linked list of active timeouts, with each timeout recording the number of additional ticks it must wait after the preceding timeout expires. It may be more efficient for a timeout to record the absolute tick count when it expires, rather than a delta.

Potential benefits:

  • k_timer_remaining_get() would no longer need to walk the list to compute how much time is left until a timer expires -- it could just subtract the current tick count from the deadline tick count.
  • It should be slightly faster to handle the removal of a timeout that is stopped before it expires, since it wouldn't be necessary to adjust the delta time of the next timeout in the list (if one exists).

Potential costs:

  • Unknown. It might be worth prototyping the change and seeing if it increases footprint significantly -- if so, the time vs. space trade-off would need to be analyzed.

(Imported from Jira ZEP-1332)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions