Thread memory usage

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
ashleyb
Member
Posts: 14
Joined: Sun Dec 20, 2009 1:08 am

Thread memory usage

Post 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


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post 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.
ashleyb
Member
Posts: 14
Joined: Sun Dec 20, 2009 1:08 am

Post 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
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post 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.
ashleyb
Member
Posts: 14
Joined: Sun Dec 20, 2009 1:08 am

Post 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.
Post Reply