Performance logging - best way

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Performance logging - best way

Post by goeck »

Hey everyone,

just a short question. I have some time critical code which performance I do measure and I have a display hooked up over SPI. Now, when I just display my data I get interference with the next performance measurements...
Is there a nice way to stuff the measurements into some portion of RAM and get back to this later for displaying?
I had some Mailboxes or InputQueus in mind, but am not sure whether this is the best approach.

Would love to hear some opinions.

cheers
Stefan
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Performance logging - best way

Post by Giovanni »

HAL TM - Time Measurement.

There is an API for this but it is only available on Cortex-M3 and M4.

Giovanni
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: Performance logging - best way

Post by goeck »

Giovanni, thanks for the answer. I know there is a mechanism that keeps best worst and latest score. Since I am on Cortex M0 I'm not able to use this anyways.
Actually my statement was maybe a bit misleading. I am able to do the measurements, that's fine. Now I want to store that somewhere since when I get one result I am in the middle of a series of measurements and I need to quickly stash the results somewhere, best would be adding a message as well that could be printed on the display later (could also done using an ID).
Here is the point. Is there a smooth way to do this? I read about memory pools and queues and mailboxes but am not sure what is the best suitable.
I guess for the beginning I'll go with mailboxes...
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Performance logging - best way

Post by Giovanni »

Hi,

Sorry for misunderstanding, if the message is one byte sized the you could use an InputQueue (write fast, read slow, excess is lost). If you need a msg_t then the MailBox is the best way. Both allow you to size the buffer without restrictions.

Giovanni
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: Performance logging - best way

Post by goeck »

Hey Giovanni,

I want to save timestamps, so a queue is no option then.
I want to use mailboxes now, but everytime I use one single mailbox command the MCU halts. I have mailboxes enabled in chconf.h...
For now I just stuff the start timestamp in an int32 variable put the difference to the fresh timestamp in there at the time when measurement is done.

Stefan
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Performance logging - best way

Post by Giovanni »

Check common errors: is the MB initialized correctly, are the functions called from the correct context and so on. In the test code there are MB examples, you could get code from there.

Giovanni
Post Reply