Number of threads in haskell program

Hi devs, Recently I became interested in obtaining the rough number of (non-GC) threads that are alive in a Haskell program. Intuitively this seemed like something that the RTS would expose in some way - but I couldn't find any such exposition in base. I then thought that I could simply total the size of each run_queue_hd in each capability, but the machinery for doing that doesn't seem to be exposed. Any thoughts? Thanks

"chessai ."
Hi devs,
Recently I became interested in obtaining the rough number of (non-GC) threads that are alive in a Haskell program. Intuitively this seemed like something that the RTS would expose in some way - but I couldn't find any such exposition in base. I then thought that I could simply total the size of each run_queue_hd in each capability, but the machinery for doing that doesn't seem to be exposed. Any thoughts?
Hi Chessai, Indeed I also needed this functionality in the past. I have a patch (just posted as !2816) which may need some polish which adds a `listThreads#` primop. Perhaps you want to pick it up? Cheers, - Ben
participants (2)
-
Ben Gamari
-
chessai .