Skip to content

Support notify hook for thread resume and suspend #426

Closed
@greglink

Description

@greglink

Problem Description
I'd like to monitor/observe (at runtime) the latency from a thread becoming ready for any reason (timer, semaphore, etc) until it begins execution, and then voluntarily suspends itself. These metrics are useful for ensuring a responsive real time operating system, and can be emitted as telemetry in formats like a histogram or high water mark to indicate potential delays or timing issues.

Describe the solution you'd like
I'd like to add/install optional callback/notify hooks in a similar fashion to the tx_thread_entry_exit_notify_ hooks, only this time for suspend and resume.

Describe alternatives you've considered
I could theoretically instrument all potential resume initiators (e.g. queues, semaphores, ...) but it seems like instrumenting at tx_thread_resume or tx_thread_system_resume might be the best/simplest location. I also considered emitting trace information, and scanning the trace information at runtime, but this seemed very heavy, as I couldn't restrict trace emission to only those events.

Additional context
I'm volunteering to write the PR, if someone can re-assure me that this won't be a rejected request for performance reasons, and inform me of whether _tx_thread_resume, _tx_thread_system_resume, or some other location is the best place to install the hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or enhancement request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions