MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / get_stack_usage

Method get_stack_usage

libraries/AP_HAL_Linux/Thread.cpp:132–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132size_t Thread::get_stack_usage()
133{
134 uint32_t *p;
135 size_t result = 0;
136
137 /* Make sure we are tracking usage for this thread */
138 if (_stack_debug.start == 0 || _stack_debug.end == 0) {
139 return 0;
140 }
141
142 if (_stack_debug.start < _stack_debug.end) {
143 for (p = _stack_debug.end; p > _stack_debug.start; p--) {
144 if (*p != STACK_POISON) {
145 break;
146 }
147 }
148 result = p - _stack_debug.start;
149 } else {
150 for (p = _stack_debug.end; p < _stack_debug.start; p++) {
151 if (*p != STACK_POISON) {
152 break;
153 }
154 }
155 result = _stack_debug.start - p;
156 }
157
158 return result;
159}
160
161bool Thread::start(const char *name, int policy, int prio)
162{

Callers 1

_debug_stackMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected