Message401769
I'm trying to do something periodically and this would be on the millisec level precision.
However for some reason I could not achieve precise timing in a task.
Below example shows that a simple sleep randomly awakes with a jitter between 0.1-20.0ms I haven't hystogrammed the distribution but it seems to be mostly 19-20ms.
Any way to achieve better timings with asyncio?
async def test_task():
while True:
ts_now = time.time();
await asyncio.sleep(1.000);
print("{}".format((time.time()-ts_now)*1000.0));
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.create_task(thread_main())
loop.run_forever() |
|
Date |
User |
Action |
Args |
2021-09-14 10:35:13 | QuadCorei8085 | set | recipients:
+ QuadCorei8085, asvetlov, yselivanov |
2021-09-14 10:35:13 | QuadCorei8085 | set | messageid: <1631615713.39.0.358857928244.issue45194@roundup.psfhosted.org> |
2021-09-14 10:35:13 | QuadCorei8085 | link | issue45194 messages |
2021-09-14 10:35:13 | QuadCorei8085 | create | |
|