RFR: 6669: FlameGraphView tree calculation should (probably) be interruptable [v5]
Marcus Hirt
hirt at openjdk.java.net
Fri Oct 23 12:11:38 UTC 2020
On Thu, 22 Oct 2020 08:07:21 GMT, Miroslav Wengner <mwengner at openjdk.org> wrote:
>> fix to bug: https://bugs.openjdk.java.net/browse/JMC-6669
>
> Miroslav Wengner has updated the pull request incrementally with one additional commit since the last revision:
>
> 6669: correction
Changes requested by hirt (Lead).
application/org.openjdk.jmc.flightrecorder.flameview/src/main/java/org/openjdk/jmc/flightrecorder/flameview/views/FlameGraphView.java line 172:
> 170: private ModelState modelState = ModelState.NONE;
> 171: private int activeModelRebuildThread;
> 172: private List<ModelRebuildRunable> modelRebuildRunnableList = new ArrayList<ModelRebuildRunable>(
Runnable with two n's.
application/org.openjdk.jmc.flightrecorder.flameview/src/main/java/org/openjdk/jmc/flightrecorder/flameview/views/FlameGraphView.java line 392:
> 390: if (!modelRebuildRunnableList.isEmpty()) {
> 391: modelRebuildRunnableList.get(activeModelRebuildThread).setInvalid();
> 392: activeModelRebuildThread = (activeModelRebuildThread + 1) % MODEL_EXECUTOR_THREADS_NUMBER;
You don't need to keep track of the threads, do you? You just need to keep track of the latest runnable. If you get another request, you simply invalidate the current one (and then you don't care what happens with it, it will worst case continue for a little bit, and then fizzle out), and update the latest to be the one from the newest request.
I.e. the only reason we're having multiple threads, it so that we allow the discovery of the cancellation to take a little bit of time, during which we can already get going with the next one. There is only ever one calculation that will have a result we care about, and that is the latest one submitted.
-------------
PR: https://git.openjdk.java.net/jmc/pull/135
More information about the jmc-dev
mailing list