-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Print scheduler details (ExecutionContext) #18
base: main
Are you sure you want to change the base?
Conversation
action = LibC::Sigaction.new | ||
action.sa_flags = LibC::SA_RESTART | ||
action.sa_sigaction = LibC::SigactionHandlerT.new do |_, _, _| | ||
print_runtime_status(details) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line doesn't compile: we can't pass a variable (here details
) to a C closure and we can't pass custom data to the sigaction handler either. We need a global variable (meh) or keep a Hash(Int32, Bool)
as a class property (sounds better).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we only need to cover two cases, maybe we could create two different procs?
if details
LibC::SigactionHandlerT.new do |_, _, _|
print_runtime_status(true)
end
else
LibC::SigactionHandlerT.new do |_, _, _|
print_runtime_status(false)
end
end
Add `GC.stop_world` and `GC.start_world` methods to be able to stop and restart the world at will from within Crystal. - gc/boehm: delegates to `GC_stop_world_external` and `GC_start_world_external`; - gc/none: implements its own mechanism (tested on UNIX & Windows). My use case is a [perf-tools](https://github.com/crystal-lang/perf-tools) feature for [RFC 2](crystal-lang/rfcs#2) that must stop the world to print out runtime information of each ExecutionContext with their schedulers and fibers. See crystal-lang/perf-tools#18
Prints runtime information about a program, either at regular interval, programmatically or on demand (through a signal), with or without the list of fibers (that can be huge). Stops the world to be able to print an accurate map of all execution contexts,
For example (idle program with a couple additional execution contexts):
Requirements:
main
)Usage:
Specify
details: true
to also print the list of fibers in each execution context.