Additional Runtime Stats Interest?

schmidtw wrote on Friday, November 02, 2012:

I have code that provides cpu usage per task.  It’s a pretty small amount of code, but before I untangle it from a few other customizations I wanted to see if there is interest.

To help me, I have changed the sprintf() format of the output & merge it in each re-base I do.  While not a lot of work, it’s not the most fun thing to do & I’ve noticed that others have looked at alternatives to sprintf() before.  Would there be interest in passing back an array of a specific data structure to an externally provided output routine instead of building the formatting into FreeRTOS?  (I’d imagine that the current default output could easily be provided if the external output function isn’t provided.)


rtel wrote on Friday, November 02, 2012:

It would definitely be beneficial to remove any sprintf()'ing from the core code, for portability reasons if nothing else.  Having the data placed into an array of structures would have been a better design choice as it would also allow the code to be processed from C code, rather than just displayed.  (the functions that perform this were only really intended as debugging aids but have seen use outside of that)

My concern with changing this code is that it would break applications that use the existing method - including many of the official FreeRTOS demos.  I would propose that, rather than change the behaviour of the existing function, a new function is added that obtains the same information but presents it in a different way (in an array of structures).

To do that the application writer would have to provide the array of structures to be filled, as the kernel could not statically declare such a structure as it would not know how big it had to be at compile time (and it would waste RAM for users that don’t use that functionality).

Can you please add a feature request into the tracker in SourceForge for this please.  I think it would be a very beneficial enhancement.


schmidtw wrote on Friday, November 02, 2012:

Yes - I’ll attach the patches of what I have in mind as well.  I should have this done by Monday.