Skip to content

Commit 065316c

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

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: micropython/utop/utop.py

+17
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ def top(update_interval_ms=1000, timeout_ms=None):
7575
print("INFO: Platform does not support listing active tasks.\x1B[K")
7676
line_count += 1
7777

78+
if esp32 is not None:
79+
print("\x1B[K")
80+
line_count += 1
81+
for name, cap in (("data", esp32.HEAP_DATA), ("exec", esp32.HEAP_EXEC)):
82+
heaps = esp32.idf_heap_info(cap)
83+
print(
84+
"IDF heap ({}): {} regions, {} total, {} free, {} largest contiguous, {} min free watermark\x1B[K".format(
85+
name,
86+
len(heaps),
87+
sum((h[0] for h in heaps)),
88+
sum((h[1] for h in heaps)),
89+
max((h[2] for h in heaps)),
90+
sum((h[3] for h in heaps)),
91+
)
92+
)
93+
line_count += 1
94+
7895
if previous_line_count > line_count:
7996
for _ in range(previous_line_count - line_count):
8097
print("\x1B[K")

0 commit comments

Comments
 (0)