Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8278277

G1: Simplify implementation of G1GCPhaseTimes::record_or_add_time_secs

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 18
    • hotspot
    • gc
    • b27

      This is a minor improvement of G1GCPhaseTimes::record_or_add_time_secs to reuse WorkerDataArray<T>::set_or_add rather than implement the logic in G1GCPhaseTimes itself.


      diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
      index 7c3eba2be94..cc4a90a36f1 100644
      --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
      +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
      @@ -266,11 +266,7 @@ void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_id, double sec
       }

       void G1GCPhaseTimes::record_or_add_time_secs(GCParPhases phase, uint worker_id, double secs) {
      - if (_gc_par_phases[phase]->get(worker_id) == _gc_par_phases[phase]->uninitialized()) {
      - record_time_secs(phase, worker_id, secs);
      - } else {
      - add_time_secs(phase, worker_id, secs);
      - }
      + _gc_par_phases[phase]->set_or_add(worker_id, secs);
       }

            mli Hamlin Li
            mli Hamlin Li
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: