How to measure memory used during program execution under rtems?

Xiaochen Pan panx at seas.upenn.edu
Fri Jun 22 22:17:34 UTC 2012


Thank you for your answer. Sorry. I didn't made it clear in the question. By 'run time memory usage', I mean 'run-time' memory usage, which is the memory usage at the same time of execution. It may be a changing number. 

By memory, I mean both heap and stack.  I am asking this question because I know that certain bsps have memory limit that if a program have a memory usage larger than that limits, the program cannot be executed. So, is there any way that can decides the largest amount of memory used in the process? 

Or I could have a most memory limited bsp and simulate the program with gdb simulator on it. If the program exits normally, it doesn't have memory problem. Is this assumption flawed?

regards,
xiaochen



On Jun 22, 2012, at 5:51 PM, Joel Sherrill wrote:

> This is a more complicated question than you think. :)
> 
> + in the tmtests, a bsp provided benchmark timer is used. This is intended to be the most accurate time measure on a board. This device is assumed to conflict with the clock tick source and the tmtests do not do any operations requiring a clock tick. They avoid causing interrupts while timing something.
> 
> + Use any nanosecond time granularity directive. These have the problem that not many bsps have the nanoseconds since last clock tick feature so the times would be very sloppy.
> 
> + Use simulator specific features.
> 
> For memory use, you would have to snapshot some stats at the beginning and end of the run. For most purposes, memory not freed is either a bug or global resource. For memory use, I assume you mean heap. For stack usage, there are services.
> 
> --joel
> 
> Xiaochen Pan <panx at seas.upenn.edu> wrote:
> 
>> Hello,
>> 
>> I need to measure the run time memory usage of programs. But I don't know what is the best way to do it? Need help.
>> 
>> Thank you,
>> xiaochen
>> _______________________________________________
>> rtems-devel mailing list
>> rtems-devel at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-devel
> 





More information about the devel mailing list