Skip to content

Commit 2cbdcf5

Browse files
committed
utop: Print IDF heap details.
Signed-off-by: Daniël van de Giessen <[email protected]>
1 parent 2aa5438 commit 2cbdcf5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: micropython/utop/utop.py

+15
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ def top(update_interval_ms=1000, timeout_ms=None):
5555
print('INFO: Platform does not support listing active tasks.\x1B[K')
5656
line_count += 1
5757

58+
if esp32 is not None:
59+
print('\x1B[K')
60+
line_count += 1
61+
for name, cap in (('data', esp32.HEAP_DATA), ('exec', esp32.HEAP_EXEC)):
62+
heaps = esp32.idf_heap_info(cap)
63+
print('IDF heap ({}): {} regions, {} total, {} free, {} largest contiguous, {} min free watermark\x1B[K'.format(
64+
name,
65+
len(heaps),
66+
sum((h[0] for h in heaps)),
67+
sum((h[1] for h in heaps)),
68+
max((h[2] for h in heaps)),
69+
sum((h[3] for h in heaps))
70+
))
71+
line_count += 1
72+
5873
if previous_line_count > line_count:
5974
for _ in range(previous_line_count - line_count):
6075
print('\x1B[K')

0 commit comments

Comments
 (0)