I'm working on a PC with 10 processor cores (20 threads), so it can support 20 concurrent computations. I often run simulations in the background on my PC such that some fraction of these, say 12, are occupied. I would like to write a function myLaunchKernels[] that launches (n) kernels, where (n) is the number of unoccupied processor threads [give or take two for system processes]. So in my dummy example, it would launch 8 kernels minus however many designated for system processes. [This may seem trivial and for me (where I can usually remember how many are in use) it often is, but it might be useful to others using distributed computing or with HPC applications with more cores and concurrent jobs.]
This essentially just requires an ability to - in Mathematica - do what one can do manually by looking at Task Manager in Windows and counting how many processes are active and consuming appreciable CPU power. If this numberActiveProcesses function returned the 12 from the above example, it would be trivial to feed this into LaunchKernels after subtracting a couple for system usage.
It would be similar to the standard $ProcessorCount; is there a similar (maybe undocumented) function for detecting the number of threads in use at the moment?