Skip to content

Commit 3f3b9c3

Browse files
committed
metrics.py: add free RAM figure.
1 parent 0302d6d commit 3f3b9c3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

v3/as_drivers/metrics/metrics.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
# metrics.py Check on scheduling performance of an application
2+
# Released under the MIT licence
3+
# Copyright (c) Peter Hinch 2020
4+
15
import uasyncio as asyncio
6+
import gc
27
from utime import ticks_us, ticks_diff
38

49

@@ -23,15 +28,18 @@ async def func():
2328
ncalls += 1
2429
t_last = t
2530
print(st.format(max_d, min_d, tot_d//ncalls, ncalls, ncalls//10))
31+
gc.collect()
32+
print('mem free', gc.mem_free())
2633
ncalls = 0
2734
max_d = 0
2835
min_d = 100_000_000
2936
tot_d = 0
3037
return func
3138

39+
# Example of call
3240
async def main():
33-
asyncio.create_task(metrics()())
41+
asyncio.create_task(metrics()()) # Note the syntax
3442
while True:
3543
await asyncio.sleep(0)
3644

37-
asyncio.run(main())
45+
#asyncio.run(main())

0 commit comments

Comments
 (0)