diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-02-21 17:02:02 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-02-21 17:02:02 (GMT) |
| commit | 326caa3fa53709786f55f8a3c2fde1ff58f831e3 (patch) | |
| tree | 4335d541d21dfcb00207808a1940fc8170544e52 | |
| parent | 88347f9c7c58153c9f23a60807324a47d16d9707 (diff) | |
tool: wasptool: Add a free memory reporting tool
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
| -rwxr-xr-x | tools/wasptool | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/wasptool b/tools/wasptool index d300dcb..3f97514 100755 --- a/tools/wasptool +++ b/tools/wasptool @@ -186,6 +186,12 @@ def handle_exec(c, fname): print_log(log) log.close() +def handle_memory_free(c): + # wasp namespace to avoid having to import into the global space + print(f'Before GC: {c.run_command("wasp.gc.mem_free()"):7}') + c.run_command('wasp.gc.collect()') + print(f'After GC: {c.run_command("wasp.gc.mem_free()"):7}') + def handle_reset(c, ota=False): cmd = 'reset' if ota: @@ -334,6 +340,8 @@ if __name__ == '__main__': help='Execute the contents of a file') parser.add_argument('--eval', help='Execute the provided python string') + parser.add_argument('--memfree', action='store_true', + help='Report on the current memory usage.') parser.add_argument('--pull', help='Fetch a file from the target') parser.add_argument('--push', @@ -409,6 +417,9 @@ if __name__ == '__main__': else: handle_upload(console, args.upload, args.upload_as) + if args.memfree: + handle_memory_free(console) + if args.console: console.close() argv = pynus.split() |
