Is it possible for the Java RTS to return information about the load the threads it manages are putting on the CPU? I have developed a number of alternative schedulers using the priority scheduler as my base (using some of the ideas brought up on this forum and some ideas from Dr. Andy Welling's book), and I would like to test them.
Specifically, since the algorithms are really simulations of other scheduling policies using priority scheduling, I am interested in determining the execution magnitudes at which the overhead associated with the simulation becomes neglectable i.e. at what execution magnitudes do the developed schedulers begin to approach the ideal system load before missing deadlines. For example, for the EDF scheduler I am interested in knowing the thread execution magnitudes at which the system load at which a deadline is first missed is 1.
Addition: I tried using the standard method of computing system load by using the sum of the ratio between execution times and periods, but jitter in my execution times cause this calculation (which I perform using average execution time for each thread) to differ from actual system load.
Neither the RTSJ nor Java RTS provide any information of this kind. Honestly I'm not sure what information could be provided.
There exist management beans in the Java platform which can report Thread CPU time used, but even if that is supported, I don't think there is any way to correlate that to elapsed time to get an indication of load.
You could probably gather this information using DTrace - by tracking the on/off-cpu transitions of each thread - but I couldn't tell you in detail how to do that.
If you're running Java RTS on Solaris, DTrace is able to provide you all the details about the time each thread is running on each processor. You could also download the tool called Thread Scheduling Visualizer (TSV) on Java RTS download page. This tool is using DTrace to record this kind of information and provides a graphical view of the scheduling of the different threads. The TSV bundle also contains a directory called DTraceToolBox with several DTrace scripts. The script named thread_cpu_prio.sh should do something close to what you're looking for.
I am currently on an RT Linux platform. I tried looking for ports of DTrace for Linux and checked out some of the Linux alternatives, such as SystemTap, but none of them appear to offer the range of functionality and ease of use of DTrace. I will be switching to OpenSolaris to give it a try. Thanks for the response.