-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fiber.top() too inaccurately measures information about time consumption of the fiber #10018
Comments
It seems our cbus endpoint fetch callback (used in fiber_pool as well) may be scheduled before Example code with no yields: local fib = require 'fiber'
local limit = 100
fib.name("worker")
box.begin()
for i = 1, 1000000 do
limit = limit -1
box.tuple.new{(n + i)%1e6, fib.id(), fib.time()}
if limit <= 0 then
box.commit()
box.begin()
limit = 100
end
end
box.commit() With it one event loop iteration takes ~18 seconds on my pc, but fiber.top() registers only a fraction of this time (18500 microseconds) |
Note how Lines 219 to 220 in ab0f791
And fiber_pool passes fiber_pool_cb() as fetch_cb to endpoint_create :tarantool/src/lib/core/fiber_pool.c Line 187 in ab0f791
fiber_pool_cb immediately calls an idle fiber, if there is one in the pool, resulting in some work being done inside the EV_ASYNC watcher before the EV_CHECK watcher. And essentially losing track of the time it took.tarantool/src/lib/core/fiber_pool.c Lines 121 to 134 in ab0f791
|
Tarantool version: 3.0.2
Context is provided to @sergepetrenko
Repro: https://gist.github.com/ochaton/21ffce3128a1f52b1e3b34cdc9e5be90
TLDR:
This code is evaluated correctly
This code not:
This is awful:
This code works ok:
The text was updated successfully, but these errors were encountered: