Skip to content

Commit 205145c

Browse files
committed
utop: Print IDF heap details.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
1 parent 0b23a1e commit 205145c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

micropython/utop/utop.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ def top(update_interval_ms=1000, timeout_ms=None, thread_names={}):
7878
micropython.mem_info()
7979
line_count += 3
8080

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

0 commit comments

Comments
 (0)