commit ba1c303d40b2b57789b4bce3e39ca709f9300547 from: Matthias L. Jugel via: GitHub date: Mon Feb 12 18:09:09 2018 UTC Update README.md commit - 2284c3fb2a9ba8e8923fb8da28d8d19350d02104 commit + ba1c303d40b2b57789b4bce3e39ca709f9300547 blob - 5a6b5d9d62b4def189cadea8c24da987a51583fe blob + a6d1e1a9a0be112a97bcb1fc8e7361b0d24c325a --- README.md +++ README.md @@ -1,2 +1,38 @@ # mbed-memtrace-logger -Analyzes and los the memtrace output from mbed-os in a readable form +Analyzes and los the memtrace output from mbed-os in a readable form. + +The memory trace outputs pretty unreadable information: + +``` +#m:0x20003080;0x182f-50 +#f:0x0;0x183f-0x20003080 +#m:0x20003080;0x182f-50 +#f:0x0;0x183f-0x20003080 +#m:0x20003080;0x182f-50 +#f:0x0;0x183f-0x20003080 +``` + +The script takes those lines and converts them into a little more readable +information and also calculates the currently allocated heap: + +``` +== 00000050 bytes, +50 (#m:0x20003080;0x182f-50) +== 00000000 bytes -50 (#f:0x0;0x183f-0x20003080) +== 00000050 bytes, +50 (#m:0x20003080;0x182f-50) +== 00000000 bytes -50 (#f:0x0;0x183f-0x20003080) +== 00000050 bytes, +50 (#m:0x20003080;0x182f-50) +== 00000000 bytes -50 (#f:0x0;0x183f-0x20003080) +``` +![logoutput.png](logoutput.png) + +# Using a log file +- enable memory tracing in your mbed program +- log uart output into a file +- run script to analyze memory state + +# Using a stream +- enable memory tracing in your mbed program +- log uart into a log file continuously: `miniterm.py /dev/cu.usbmodem1234 9600 | tee memtrace.log` +- run script to tail file `python memtrace.py memtrace.log KEYWORD` + +Enjoy!