1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-23 07:58:09 +00:00

trezor.main: fix for new loop

This commit is contained in:
Jan Pochyla 2017-01-06 14:06:03 +01:00
parent 930668223b
commit d30e565cb3

View File

@ -7,20 +7,21 @@ from trezor import loop
from trezor import workflow from trezor import workflow
from trezor import log from trezor import log
log.level = log.INFO log.level = log.DEBUG
# log.level = log.INFO
def perf_info_debug(): def perf_info_debug():
while True: while True:
queue = [str(x[2]).split("'")[1] for x in loop.scheduled_tasks] queue_len = len(loop._scheduled_tasks)
delay_avg = sum(loop.log_delay_rb) / loop.log_delay_rb_len delay_avg = sum(loop.log_delay_rb) / loop.log_delay_rb_len
delay_last = loop.log_delay_rb[loop.log_delay_pos] delay_last = loop.log_delay_rb[loop.log_delay_pos]
mem_alloc = gc.mem_alloc() mem_alloc = gc.mem_alloc()
gc.collect() gc.collect()
log.debug(__name__, "mem_alloc: %s/%s, delay_avg: %d, delay_last: %d, queue: %s", log.debug(__name__, "mem_alloc: %s/%s, delay_avg: %d, delay_last: %d, queue_len: %d",
mem_alloc, gc.mem_alloc(), delay_avg, delay_last, ', '.join(queue)) mem_alloc, gc.mem_alloc(), delay_avg, delay_last, queue_len)
yield loop.Sleep(1000000) yield loop.Sleep(1000000)