RFR: Avoid divide by zero error, improve variable names
Y. Srinivas Ramakrishna
ysr at openjdk.org
Thu Dec 22 00:02:22 UTC 2022
On Wed, 21 Dec 2022 22:19:13 GMT, William Kemper <wkemper at openjdk.org> wrote:
> Depending on when the periodic thread runs the accounting task and how much CPU time the process receives, we may see a very small elapsed process time. Such a time should not be used to compute MMU.
src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp line 106:
> 104: double elapsed_collector_time_s = collector_time_s - _collector_reference_time_s;
> 105: _collector_reference_time_s = collector_time_s;
> 106: double minimum_mutator_utilization = ((elapsed_process_time_s - elapsed_collector_time_s) / elapsed_process_time_s) * 100;
Alternative: You could check if result `isnan()` and not use it, although I don't know if divide by zero is costly.
-------------
PR: https://git.openjdk.org/shenandoah/pull/188
More information about the shenandoah-dev
mailing list