Skip to content
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

Precise busy computation / stop counting when fiber is resolved #40

Merged
merged 4 commits into from
Mar 28, 2023

Conversation

TheLortex
Copy link
Contributor

  • Because the suspend event was not handled, the last fiber before suspension would be considered busy even if it was sleeping.
  • Runtime events provide precise timers, we can use them to know when fiber switches happen, it will be more precise then getting the current timestamp when the event is read from the queue. This way, we also avoid using refresh_active_tasks which was in charge of incrementing the busy counter of the active fiber. Instead the total busy value is known when the fiber infos are rendered.
  • When a fiber resolves, the idle value keeps increasing. Instead we can stop the counter when that happens.

I have also added text colors depending on the fiber state:

  • white: active and paused
  • bold: active and busy
  • gray: resolved

otherwise the fiber that is active before suspension will be considered
active for the whole sleep period.
also display different text colors depending on fiber state
@patricoferris
Copy link
Collaborator

This should fix https://github.com/patricoferris/meio/issues/27 ?

@TheLortex
Copy link
Contributor Author

There's still a decision to take of when should they be collected, i.e. disappear from the screen ?

It's possible to implement a flexible strategy: never GC them, but hide them after a fixed delay, and add a way for the user to bring them back if needed.

@patricoferris
Copy link
Collaborator

It's possible to implement a flexible strategy: never GC them, but hide them after a fixed delay, and add a way for the user to bring them back if needed.

Whatever we decide don't let it block this PR :))

Hiding after a fixed delay seems reasonable, and until your extremely nice tree-view lands I don't think people will want to ever see them again as the console will be pretty hard to understand. We still might need some GC for Fiber.fork-heavy code if the table gets massive.

@TheLortex TheLortex merged commit da1d961 into ocaml-multicore:main Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants