New submission from QuadCorei8085 <gulyast....@gmail.com>:

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()

----------
components: asyncio
messages: 401769
nosy: QuadCorei8085, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio scheduler jitter
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45194>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to