The pulse loggers assumed that a pulse rendering finishes before the next pulse 
rendering starts. That isn't true anymore when multithreaded is enabled (the 
default now), and causes a NullPointerException in the print logger and breaks 
the application completely.

Problems
- Both loggers kept a single pulse currently rendering field. When the next 
pulse started rendering early, it overwrote that field
- The end notification relied on counting completed scenes. When a scene was 
skipped, the notification never came
- The print logger measured each pulse duration up to when it was printed. A 
pulse that had to wait behind a previous pulse render showed a wrong time

Changes
- PaintCollector: sends the end notification as an extra render job after each 
render pass. Render jobs run in order on one thread, so every render start now 
has exactly one matching end
- PrintLogger: tracks pulses being rendered in a queue instead of one field. 
And each pulse duration is measured up to when it completed.
- JFRPulseLogger: uses the same queue now, so events get the correct pulse ID 
instead of the next pulse ID orĀ 0.

A note about reviewing: Even though those are some larger changes, there isn't 
a need to be very rigorous when reviewing.
Any code that is changed is not running in normal apps, only when the pulse 
logger is enabled. And since that feature is broken right now (and has been for 
many years), it can only get better.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - Fix potentially wrong total time
 - fix jfr pulse logger
 - Fix NPE

Changes: https://git.openjdk.org/jfx/pull/2368/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2368&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8397225
  Stats: 83 lines in 3 files changed: 39 ins; 23 del; 21 mod
  Patch: https://git.openjdk.org/jfx/pull/2368.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2368/head:pull/2368

PR: https://git.openjdk.org/jfx/pull/2368

Reply via email to