avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Stack usage profiling for function calls.


From: Mattias Svensson
Subject: [avr-gcc-list] Stack usage profiling for function calls.
Date: Mon, 31 Mar 2003 18:50:05 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1

I made this post earlier and got one reply that said that for mips-gcc the option -mstats gives the output I am looking for. But it is not applicable to avr-gcc.

It is important to know how much stack is used with small RAM and no mem protection.
I don't know if I am alone with this need?

Since gcc tracks the prologue and epiloge sizes for each function (output to the assembler listing) it would not be to hard to make a summary of the number of "push" calls for each function. In fact in most cases the prologue size is the same as the number of "push" calls.

I have not made the nosedive into the GCC sources yet, but it would probaly not be to complicated to make a summary for each function e.g. at the bottom of the assembler listing.

Any suggestions on the best way to do it?

Maybe a look at the mips-gcc code would be a good idea...

The optimal tool would take a function and recurively run through each sub function and sum the stack usage and report the deepest usage. This of course requires the code to be deterministic, not depending on variables or hw events. But correctly used it would be a good tool.

/M Svensson

-------- Original Message --------
Subject: [avr-gcc-list] Stack usage profiling for function calls.
Date: Thu, 20 Mar 2003 10:26:43 +0100
From: Mattias Svensson <address@hidden>
To: address@hidden

I Wonder if there is any tool available that takes a function written in
C and traces the stack usage of subsequent calls to other functions.

Today I read the assembler listing file ".list" output from avr-gcc and
trace how many registers are pushed onto the stack for each function, it
works but is kind of time consuming...

Maybe I have missed some nice switch for avr-gcc that generates what I want.

It is also possible to make a mem dump and see how deep the stack has
grown since all RAM is zeroed at init. But it is not accurate enough,
some worst case scenarios are easily missed.

Regards:
M Svensson.


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list




reply via email to

[Prev in Thread] Current Thread [Next in Thread]