Page 1 of 1

Thread memory usage

Posted: Fri Apr 23, 2010 8:20 am
by ashleyb
Hi all,
Is there a way I can find out the individual code and stack footprints of each thread?

No the xmapper is not an option, it doesn't provide individual usage for each thread, just each core.

Thanks,

Ashley

Re: Thread memory usage

Posted: Fri Apr 23, 2010 3:38 pm
by richard
If you pass --report to xcc instead of --show-report you will get a resource usage breakdown for every function after the executable is built, for example:

Function: signed int f()
stack words: 102
max threads: 1
max timers: 0
max chanends: 0

Assuming each thread is implemented in a separate function you can use this to work out the resource usage of your threads.

Re: Thread memory usage

Posted: Sat Apr 24, 2010 12:01 am
by ashleyb
Thanks Richard,

Adding that causes the build to fail with

Code: Select all

xmap: Error: Value of undefined resource symbol "__fwalk.nstackwords" cannot be determined.
xmap: Error:   ...needed for function _fwalk
Also this doesn't provide the code size.

Thanks,

Ashley

Re: Thread memory usage

Posted: Mon Apr 26, 2010 11:35 am
by richard
--report causing compilation failure when there is a function with unknown resource is a bug. The values that are reported should still be correct.

There is currently no option to dump the code size of a function. You could the dump the list of symbols and addresses with xobjdump -t and then sort the output by the address (first column). Looking at the difference from the address of a function to the address of the next symbol gives you the size of that function.

Re: Thread memory usage

Posted: Mon Apr 26, 2010 12:14 pm
by ashleyb
Thanks, looks like I'm going to have to write a little tool to do it.

I would have thought that the existing mapper would have done it since it needs to track both code and stack usage for resource utilisation checks.