Question:
Purpose of GetThreadStackUsage() function in VDSP toolchain?
Answer:
GetThreadStackUsage() calculates the stack usage using the below method:
When configured for Full Instrumentation, VDK fills each thread stack with a known value 0xDEADBEEF. This property is then used to determine the maximum amount of stack used by a specified thread. This is done by calculating the amount of memory in words between the end of stack and the first word that no longer contains 0xDEADBEEF, this value is then subtracted from the stack size to get the stack used.
Note that the value retrieved using this method is an approximation of the maximum amount of stack that has been used up until that point.