Skip to content

Commit 2cadd4a

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

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
@@ -77,6 +77,23 @@ def top(update_interval_ms=1000, timeout_ms=None, thread_names={}):
7777
print("INFO: Platform does not support listing active tasks.\x1B[K")
7878
line_count += 1
7979

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

0 commit comments

Comments
 (0)