Reply by Tom Gardner February 10, 20162016-02-10
On 10/02/16 12:58, davidbp.13 wrote:
> I managed to evaluate execution time using Arduino and running micros() > before and after the function and then measuring the time difference and I > got good results.
Or flip an i/o pin and look at it with a DMM to see the mean, or with a scope to see the variability.
Reply by February 10, 20162016-02-10
On Wed, 10 Feb 2016 06:58:48 -0600, "davidbp.13"
<111876@EmbeddedRelated> wrote:

>Hello. > >I have the task of evaluate functions of C implemented libraries that will >run on embedded systems. Those libraries are implemented in .h files and >then included in implementations. > >I was given a FFT library implemented in C that was meant to run on >Arduino. In the readme file of the library there are two charts measuring >execution time, RAM and FLASH usage of each of the functions that compose >the library. I need to find a way to make those measurements and see if >they match with what is given in that file. > >I managed to evaluate execution time using Arduino and running micros() >before and after the function and then measuring the time difference and I >got good results. But I still haven't found a way of measuring memory >usage. I need to find a way of measuring FLASH (memory that takes the code >itself) for each function and SRAM (global and local variables) also for >each function. I need to find a compiler that provides a memory map, or a >code to make the measurement or something similar. I know that measuring >dynamic data can be tricky so by far I have just tried to use the >MemoryFree library for Arduino and the information that the compiler >provides but got no useful results since I need it for every function and >not for the hole code and also because the mentioned library gave no >useful results. I have also googled a lot but found nothing. > >I really appreciate if someone know how to do that or know where can I >find useful information about it. > >Thanks in advance. > > >--------------------------------------- >Posted through http://www.EmbeddedRelated.com
For code and static data, any decent linker will produce a memory map. Take the values from there. As a general method for measuring stack and dynamic memory usage, fill the stack and dynamic memory pool with a known pattern, such as 0xA5, execute the function and after that how much memory doesn't anymore contain that pattern (such as 0xA5). If the stack grows downwards, look at the lowest address that doesn't contain that pattern. If the dynamic pool grows upwards, look for the highest byte that doesn't contain that pattern. With the help of the linker map, you should be able to calculate the stack and dynamic memory used by each function.
Reply by davidbp.13 February 10, 20162016-02-10
Hello. 

I have the task of evaluate functions of C implemented libraries that will
run on embedded systems. Those libraries are implemented in .h files and
then included in implementations.

I was given a FFT library implemented in C that was meant to run on
Arduino. In the readme file of the library there are two charts measuring
execution time, RAM and FLASH usage of each of the functions that compose
the library. I need to find a way to make those measurements and see if
they match with what is given in that file.

I managed to evaluate execution time using Arduino and running micros()
before and after the function and then measuring the time difference and I
got good results. But I still haven't found a way of measuring memory
usage. I need to find a way of measuring FLASH (memory that takes the code
itself) for each function and SRAM (global and local variables) also for
each function. I need to find a compiler that provides a memory map, or a
code to make the measurement or something similar. I know that measuring
dynamic data can be tricky so by far I have just tried to use the
MemoryFree library for Arduino and the information that the compiler
provides but got no useful results since I need it for every function and
not for the hole code and also because the mentioned library gave no
useful results. I have also googled a lot but found nothing.

I really appreciate if someone know how to do that or know where can I
find useful information about it. 

Thanks in advance.


---------------------------------------
Posted through http://www.EmbeddedRelated.com