Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[General] How can I measure execution time and memory usage of C implemented libraries?

Status
Not open for further replies.

davidbp.13

Newbie level 1
Joined
Feb 10, 2016
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
18
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.

PS: Attached you can find the FFT library (including the readme file with the charts).
 

Attachments

  • ArduinoFFT.zip
    27.7 KB · Views: 77

Hi,

to measure the execution time for a function: (works in either way, with every complier)
* SET a port pin before you start the function
* CLEAR a port pin after leaving the function.
Use a scope to measure the "high" time of the port pin.

I´m not familiar with C, so I can´t help with flash and SRAM.

But sometimes it is usefull to know the max. stack size:
* Either initialize the memory area of the stack with a known value and check how many values are altered during after execution.
* or run (random) timer interrupts, that simply read stack pointer vlaue and stor the max. value. Mind that the timer interrupt usually needs extra stack values.

Hope this helps - at least a bit.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top