-
I have a test code below
I noticed if I only make 10 loops, the print will say about ~105ms (5ms + the 100ms sleep) when I increase it to 100 loops, it prints ~120ms (20ms + 100ms sleep). I'm guessing there's some runtime schedule overhead which is adding the latency? or I missed anything? basically what I want to do is to measure the time spent in executing a future, excluding the runtime overhead. and apparently establishing the conn should only takes 5ms which is the case when there are 10 futs executing. so what's the correct way to:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Sleep is not precise. There is no guarantee it will return after exactly 100ms. It will probably take longer. |
Beta Was this translation helpful? Give feedback.
-
i think i figured it out https://work.yba.dev/what-s-the-time-in-tokio |
Beta Was this translation helpful? Give feedback.
i think i figured it out https://work.yba.dev/what-s-the-time-in-tokio