Hi!
Thank you for the amazing software. I have been using FreeRTOS for many years.
For a course I am developing I was playing around with the tracing hooks, and after spending some time with it I don’t see a ‘proper’ way of correctly tracing the fill state of a queue with the given tracing hooks.
Specifically, the hooks don’t seem to fully cover queue overrides and resets.
First, overrides:
The traceQUEUE_SEND
hook is called on any sucesfull call to xQueueGenericSend
, including if xCopyPosition == queueOVERWRITE
:
BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
const void * const pvItemToQueue,
TickType_t xTicksToWait,
const BaseType_t xCopyPosition )
{
BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired;
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
// --- snip asserts ---
for( ; ; )
{
taskENTER_CRITICAL();
{
// --- snip comment ---
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
{
traceQUEUE_SEND( pxQueue );
...
After pull request #47, the above traceQUEUE_SEND
is the only place that this hook is called, so in theory it would be possible to access xCopyPosition
from within the hook, but this seems hacky and fragile. But without this information, my tracer cannot determine if a traceQUEUE_SEND
event increased or decreased the number of items in the queue.
I could rely on the traceENTER_xQueueGenericSend
hook, but it would seem desirable to write a full tracer without having to rely on these, which would require significant logic in the
trace event decoding and create many more tracing events.
The same issue exists for the traceQUEUE_SEND_ISR
hook of course.
Secondly, xQueueGenericReset
does not have any tracing hooks, except for the ENTER
and RETURN
ones, which on their own don’t given any infromation about the sucess of the reset and would again require multiple events and tracer logic to properly decode.
First, is this assessment correct? I have looked around for other issues and solutions but have not found anything. Of course I don’t want to rule out that I have missed something obvious or that there are many other problems to tracing queue fill levels that I missed
If so, is there any interest in this getting updated? I would be happy to put together a PR. It would seem fairly simple (and backwards compatible) to include a new traceQUEUE_RESET(..)
hook.
The issues with traceQUEUE_SEND
I am not immediately sure how to address in a backwards-compatible manner, as adding a xCopyPostion
parameter would be a breaking change. Is there some preference/precedent to how this should be handled? Maybe adding a second, redundant tracing hook?
// --snip--
traceQUEUE_SEND( pxQueue );
traceQUEUE_SEND_EXT( pxQueue, xCopyPosition );
// --snip--
As mentioned, I am happy to implement this and create a PR, but thought I would first ask for feedback if there is interest and preference for how this should be done, to avoid redundant work
Thank you again!
Philipp