diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-31 02:34:39 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-31 02:34:39 +0300 |
commit | 914bcf16d847400f91525ba82775adc973cae52a (patch) | |
tree | c26072b1be94f1e07ec6a55c8ec4d951ea608078 /unix/main.c | |
parent | b30a777ace4440bbd439419ba51cc60d7dd501f0 (diff) | |
download | micropython-914bcf16d847400f91525ba82775adc973cae52a.tar.gz micropython-914bcf16d847400f91525ba82775adc973cae52a.zip |
unix: Add poorman's stack usage info to mem_info() dump.
Diffstat (limited to 'unix/main.c')
-rw-r--r-- | unix/main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/unix/main.c b/unix/main.c index 884ee9d32d..938c133d41 100644 --- a/unix/main.c +++ b/unix/main.c @@ -63,7 +63,7 @@ long heap_size = 128*1024 * (sizeof(machine_uint_t) / 4); #endif // Stack top at the start of program -void *stack_top; +char *stack_top; void microsocket_init(); void time_init(); @@ -212,7 +212,10 @@ int usage(char **argv) { } mp_obj_t mem_info(void) { - printf("mem: total=%d, current=%d, peak=%d\n", m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated()); + volatile int stack_dummy; + printf("mem: total=%d, current=%d, peak=%d\n", + m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated()); + printf("stack: %d\n", stack_top - (char*)&stack_dummy); #if MICROPY_ENABLE_GC gc_dump_info(); #endif @@ -258,7 +261,7 @@ void pre_process_options(int argc, char **argv) { int main(int argc, char **argv) { volatile int stack_dummy; - stack_top = (void*)&stack_dummy; + stack_top = (char*)&stack_dummy; pre_process_options(argc, argv); |