Page 1 of 1

Performance logging - best way

Posted: Wed Nov 27, 2013 4:00 pm
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

Re: Performance logging - best way

Posted: Wed Nov 27, 2013 5:21 pm
by Giovanni
HAL TM - Time Measurement.

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

Giovanni

Re: Performance logging - best way

Posted: Thu Nov 28, 2013 8:57 am
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...

Re: Performance logging - best way

Posted: Thu Nov 28, 2013 11:18 am
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

Re: Performance logging - best way

Posted: Thu Nov 28, 2013 3:49 pm
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

Re: Performance logging - best way

Posted: Thu Nov 28, 2013 4:24 pm
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