Skip to content

Commit

Permalink
utop: Print IDF heap details.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
  • Loading branch information
DvdGiessen committed Mar 7, 2024
1 parent d11d654 commit 065316c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions micropython/utop/utop.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ def top(update_interval_ms=1000, timeout_ms=None):
print("INFO: Platform does not support listing active tasks.\x1B[K")
line_count += 1

if esp32 is not None:
print("\x1B[K")
line_count += 1
for name, cap in (("data", esp32.HEAP_DATA), ("exec", esp32.HEAP_EXEC)):
heaps = esp32.idf_heap_info(cap)
print(
"IDF heap ({}): {} regions, {} total, {} free, {} largest contiguous, {} min free watermark\x1B[K".format(
name,
len(heaps),
sum((h[0] for h in heaps)),
sum((h[1] for h in heaps)),
max((h[2] for h in heaps)),
sum((h[3] for h in heaps)),
)
)
line_count += 1

if previous_line_count > line_count:
for _ in range(previous_line_count - line_count):
print("\x1B[K")
Expand Down

0 comments on commit 065316c

Please sign in to comment.