Support query of currently active section
Provide the section for which Bytecode is currently measured (if the measurement is not finished). Use a parameter to switch this behavior on or off.
ByCounter has now been adapted as proposed. The EMF version was implemented as well.
There can be more than one active section in the case of threads executed in parallel. The interface should be modified from queryActiveSection() to queryActiveSection(long threadId). Furthermore, the method should return the appropriate EntityToInstrument and not an internal administration object like ActiveSection.
The resulting method signature should be:
EntityToInstrument queryActiveSection(long threadId)
Implement also in EMF-version:
EntityToInstrument ByCounterWrapper.queryActiveSection(long threadId);
This implementation allows direct access to the information on model-level.
As requested, queryActiveSection() can now throw an InvalidQueryException.
Calling queryActiveSection() if the configuration parameter is not set should throw an exception giving the explanation the this will only return a value with the configuration parameter set to true. If the currently active section cannot be determined and the parameter is set, it should still return null.
Querying support is now available if the option InstrumentationParameters.setProvideOnlineSectionActiveUpdates(true) is provided. For this purpose, CountingResultCollector has a new method queryActiveSection(). This method will return the section that is currently being executed if the section was specified for instrumentation. Null is returned in any other execution state.
This means that querying the active section is very dependent on timing. The new test case TestQueryUpdates therefore uses synchronisation to be able to reliably query all sections during execution of the test code.