Last active
May 4, 2018 16:31
-
-
Save boochow/7ac60b9a4f489fe5ae36bcd5d44177bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import machine, utime | |
log = [] | |
def add_log(t): | |
global log | |
log.append((utime.ticks_us() & 0xffffffff) + 1000 - t.compare_register()) | |
times = 1000 | |
tim = machine.Timer(3) | |
tim.init(period=1000,mode=tim.PERIODIC,callback=lambda t:add_log(t)) | |
while(tim.counter() < times + 1): | |
pass | |
tim.deinit() | |
for i in range(min(log),max(log) + 1): | |
print(i, log.count(i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment