src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp
author sangheki
Thu, 28 Sep 2017 12:13:57 -0700
changeset 47556 1520941b7b5d
parent 47216 71c04702a3d5
child 49360 886acec3b4c6
permissions -rw-r--r--
8186465: Each j.l.Reference elapsed time log is incorrect Summary: Fixed wrongly referencing variable and updated regression test to compare each elapsed time vs. sum of those Reviewed-by: stefank, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46795
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     1
/*
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     4
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     7
 * published by the Free Software Foundation.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     8
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    13
 * accompanied this code).
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    14
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    18
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    21
 * questions.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    22
 *
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    23
 */
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    24
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    25
#include "precompiled.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    26
#include "gc/shared/gcTimer.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    27
#include "gc/shared/referenceProcessorPhaseTimes.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    28
#include "gc/shared/referenceProcessor.inline.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    29
#include "logging/log.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    30
#include "logging/logStream.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    31
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    32
RefProcWorkerTimeTracker::RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers number,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    33
                                                   ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    34
                                                   uint worker_id) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    35
  _worker_time(NULL), _start_time(os::elapsedTime()), _worker_id(worker_id) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    36
  assert (phase_times != NULL, "Invariant");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    37
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    38
  _worker_time = phase_times->worker_time_sec(phase_times->par_phase(number));
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    39
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    40
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    41
RefProcWorkerTimeTracker::RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcParPhases phase,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    42
                                                   ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    43
                                                   uint worker_id) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    44
  _worker_time(NULL), _start_time(os::elapsedTime()), _worker_id(worker_id) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    45
  assert (phase_times != NULL, "Invariant");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    46
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    47
  _worker_time = phase_times->worker_time_sec(phase);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    48
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    49
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    50
RefProcWorkerTimeTracker::~RefProcWorkerTimeTracker() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    51
  _worker_time->set(_worker_id, os::elapsedTime() - _start_time);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    52
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    53
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    54
RefProcPhaseTimeBaseTracker::RefProcPhaseTimeBaseTracker(const char* title,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    55
                                                         ReferenceProcessorPhaseTimes* phase_times) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    56
  _title(title), _phase_times(phase_times), _start_ticks(), _end_ticks() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    57
  assert(_phase_times != NULL, "Invariant");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    58
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    59
  _start_ticks.stamp();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    60
  if (_phase_times->gc_timer() != NULL) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    61
    _phase_times->gc_timer()->register_gc_phase_start(_title, _start_ticks);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    62
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    63
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    64
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    65
static const char* phase_enum_2_phase_string(ReferenceProcessorPhaseTimes::RefProcParPhases phase) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    66
  switch(phase) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    67
    case ReferenceProcessorPhaseTimes::SoftRefPhase1:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    68
      return "Phase1";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    69
    case ReferenceProcessorPhaseTimes::SoftRefPhase2:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    70
    case ReferenceProcessorPhaseTimes::WeakRefPhase2:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    71
    case ReferenceProcessorPhaseTimes::FinalRefPhase2:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    72
    case ReferenceProcessorPhaseTimes::PhantomRefPhase2:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    73
      return "Phase2";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    74
    case ReferenceProcessorPhaseTimes::SoftRefPhase3:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    75
    case ReferenceProcessorPhaseTimes::WeakRefPhase3:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    76
    case ReferenceProcessorPhaseTimes::FinalRefPhase3:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    77
    case ReferenceProcessorPhaseTimes::PhantomRefPhase3:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    78
      return "Phase3";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    79
    case ReferenceProcessorPhaseTimes::RefEnqueue:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    80
      return "Reference Enqueuing";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    81
    default:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    82
      ShouldNotReachHere();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    83
      return NULL;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    84
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    85
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    86
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    87
static const char* Indents[6] = {"", "  ", "    ", "      ", "        ", "          "};
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    88
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    89
Ticks RefProcPhaseTimeBaseTracker::end_ticks() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    90
  // If ASSERT is defined, the default value of Ticks will be -2.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    91
  if (_end_ticks.value() <= 0) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    92
    _end_ticks.stamp();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    93
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    94
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    95
  return _end_ticks;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    96
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    97
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    98
double RefProcPhaseTimeBaseTracker::elapsed_time() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    99
  jlong end_value = end_ticks().value();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   100
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   101
  return TimeHelper::counter_to_millis(end_value - _start_ticks.value());
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   102
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   103
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   104
RefProcPhaseTimeBaseTracker::~RefProcPhaseTimeBaseTracker() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   105
  if (_phase_times->gc_timer() != NULL) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   106
    Ticks ticks = end_ticks();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   107
    _phase_times->gc_timer()->register_gc_phase_end(ticks);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   108
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   109
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   110
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   111
RefProcBalanceQueuesTimeTracker::RefProcBalanceQueuesTimeTracker(ReferenceProcessorPhaseTimes* phase_times) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   112
  RefProcPhaseTimeBaseTracker("Balance queues", phase_times) {}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   113
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   114
RefProcBalanceQueuesTimeTracker::~RefProcBalanceQueuesTimeTracker() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   115
  double elapsed = elapsed_time();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   116
  phase_times()->set_balance_queues_time_ms(phase_times()->processing_ref_type(), elapsed);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   117
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   118
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   119
#define ASSERT_REF_TYPE(ref_type) assert(ref_type >= REF_SOFT && ref_type <= REF_PHANTOM, \
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   120
                                         "Invariant (%d)", (int)ref_type)
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   121
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   122
#define ASSERT_PHASE_NUMBER(phase_number) assert(phase_number >= ReferenceProcessorPhaseTimes::RefPhase1 && \
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   123
                                                 phase_number <= ReferenceProcessorPhaseTimes::RefPhaseMax, \
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   124
                                                 "Invariant (%d)", phase_number);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   125
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   126
static const char* phase_number_2_string(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers phase_number) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   127
  ASSERT_PHASE_NUMBER(phase_number);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   128
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   129
  switch(phase_number) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   130
    case ReferenceProcessorPhaseTimes::RefPhase1:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   131
      return "Phase1";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   132
    case ReferenceProcessorPhaseTimes::RefPhase2:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   133
      return "Phase2";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   134
    case ReferenceProcessorPhaseTimes::RefPhase3:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   135
      return "Phase3";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   136
    default:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   137
      ShouldNotReachHere();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   138
      return NULL;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   139
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   140
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   141
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   142
RefProcParPhaseTimeTracker::RefProcParPhaseTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers phase_number,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   143
                                                       ReferenceProcessorPhaseTimes* phase_times) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   144
  _phase_number(phase_number),
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   145
  RefProcPhaseTimeBaseTracker(phase_number_2_string(phase_number), phase_times) {}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   146
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   147
RefProcParPhaseTimeTracker::~RefProcParPhaseTimeTracker() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   148
  double elapsed = elapsed_time();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   149
  ReferenceProcessorPhaseTimes::RefProcParPhases phase = phase_times()->par_phase(_phase_number);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   150
  phase_times()->set_par_phase_time_ms(phase, elapsed);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   151
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   152
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   153
static const char* ref_type_2_string(ReferenceType ref_type) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   154
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   155
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   156
  switch(ref_type) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   157
    case REF_SOFT:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   158
      return "SoftReference";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   159
    case REF_WEAK:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   160
      return "WeakReference";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   161
    case REF_FINAL:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   162
      return "FinalReference";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   163
    case REF_PHANTOM:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   164
      return "PhantomReference";
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   165
    default:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   166
      ShouldNotReachHere();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   167
      return NULL;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   168
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   169
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   170
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   171
RefProcPhaseTimesTracker::RefProcPhaseTimesTracker(ReferenceType ref_type,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   172
                                                   ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   173
                                                   ReferenceProcessor* rp) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   174
  _rp(rp), RefProcPhaseTimeBaseTracker(ref_type_2_string(ref_type), phase_times) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   175
  phase_times->set_processing_ref_type(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   176
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   177
  size_t discovered = rp->total_reference_count(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   178
  phase_times->set_ref_discovered(ref_type, discovered);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   179
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   180
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   181
RefProcPhaseTimesTracker::~RefProcPhaseTimesTracker() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   182
  double elapsed = elapsed_time();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   183
  ReferenceProcessorPhaseTimes* times = phase_times();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   184
  ReferenceType ref_type = times->processing_ref_type();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   185
  times->set_ref_proc_time_ms(ref_type, elapsed);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   186
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   187
  size_t after_count = _rp->total_reference_count(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   188
  size_t discovered = times->ref_discovered(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   189
  times->set_ref_cleared(ref_type, discovered - after_count);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   190
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   191
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   192
RefProcEnqueueTimeTracker::RefProcEnqueueTimeTracker(ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   193
                                                     ReferenceProcessorStats& stats) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   194
  RefProcPhaseTimeBaseTracker("Reference Enqueuing", phase_times) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   195
    phase_times->set_ref_enqueued(REF_SOFT, stats.soft_count());
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   196
    phase_times->set_ref_enqueued(REF_WEAK, stats.weak_count());
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   197
    phase_times->set_ref_enqueued(REF_FINAL, stats.final_count());
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   198
    phase_times->set_ref_enqueued(REF_PHANTOM, stats.phantom_count());
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   199
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   200
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   201
RefProcEnqueueTimeTracker::~RefProcEnqueueTimeTracker() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   202
  double elapsed = elapsed_time();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   203
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   204
  phase_times()->set_par_phase_time_ms(ReferenceProcessorPhaseTimes::RefEnqueue, elapsed);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   205
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   206
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   207
ReferenceProcessorPhaseTimes::ReferenceProcessorPhaseTimes(GCTimer* gc_timer, uint max_gc_threads) :
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   208
  _gc_timer(gc_timer), _processing_is_mt(false) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   209
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   210
  for (int i = 0; i < RefParPhaseMax; i++) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   211
    _worker_time_sec[i] = new WorkerDataArray<double>(max_gc_threads, "Process lists (ms)");
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   212
    _par_phase_time_ms[i] = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   213
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   214
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   215
  for (int i = 0; i < number_of_subclasses_of_ref; i++) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   216
    _ref_proc_time_ms[i] = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   217
    _balance_queues_time_ms[i] = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   218
    _ref_cleared[i] = 0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   219
    _ref_discovered[i] = 0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   220
    _ref_enqueued[i] = 0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   221
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   222
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   223
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   224
inline int ref_type_2_index(ReferenceType ref_type) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   225
  return ref_type - REF_SOFT;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   226
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   227
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   228
#define ASSERT_PAR_PHASE(phase) assert(phase >= ReferenceProcessorPhaseTimes::SoftRefPhase1 && \
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   229
                                       phase < ReferenceProcessorPhaseTimes::RefParPhaseMax, \
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   230
                                       "Invariant (%d)", (int)phase);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   231
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   232
WorkerDataArray<double>* ReferenceProcessorPhaseTimes::worker_time_sec(RefProcParPhases par_phase) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   233
  ASSERT_PAR_PHASE(par_phase);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   234
  return _worker_time_sec[par_phase];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   235
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   236
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   237
double ReferenceProcessorPhaseTimes::par_phase_time_ms(RefProcParPhases par_phase) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   238
  ASSERT_PAR_PHASE(par_phase);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   239
  return _par_phase_time_ms[par_phase];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   240
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   241
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   242
void ReferenceProcessorPhaseTimes::set_par_phase_time_ms(RefProcParPhases par_phase,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   243
                                                         double par_phase_time_ms) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   244
  ASSERT_PAR_PHASE(par_phase);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   245
  _par_phase_time_ms[par_phase] = par_phase_time_ms;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   246
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   247
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   248
void ReferenceProcessorPhaseTimes::reset() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   249
  for (int i = 0; i < RefParPhaseMax; i++) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   250
    _worker_time_sec[i]->reset();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   251
    _par_phase_time_ms[i] = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   252
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   253
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   254
  for (int i = 0; i < number_of_subclasses_of_ref; i++) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   255
    _ref_proc_time_ms[i] = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   256
    _balance_queues_time_ms[i] = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   257
    _ref_cleared[i] = 0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   258
    _ref_discovered[i] = 0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   259
    _ref_enqueued[i] = 0;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   260
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   261
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   262
  _total_time_ms = uninitialized();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   263
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   264
  _processing_is_mt = false;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   265
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   266
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   267
ReferenceProcessorPhaseTimes::~ReferenceProcessorPhaseTimes() {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   268
  for (int i = 0; i < RefParPhaseMax; i++) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   269
    delete _worker_time_sec[i];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   270
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   271
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   272
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   273
double ReferenceProcessorPhaseTimes::ref_proc_time_ms(ReferenceType ref_type) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   274
  ASSERT_REF_TYPE(ref_type);
47556
1520941b7b5d 8186465: Each j.l.Reference elapsed time log is incorrect
sangheki
parents: 47216
diff changeset
   275
  return _ref_proc_time_ms[ref_type_2_index(ref_type)];
46795
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   276
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   277
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   278
void ReferenceProcessorPhaseTimes::set_ref_proc_time_ms(ReferenceType ref_type,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   279
                                                        double ref_proc_time_ms) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   280
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   281
  _ref_proc_time_ms[ref_type_2_index(ref_type)] = ref_proc_time_ms;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   282
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   283
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   284
size_t ReferenceProcessorPhaseTimes::ref_cleared(ReferenceType ref_type) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   285
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   286
  return _ref_cleared[ref_type_2_index(ref_type)];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   287
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   288
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   289
void ReferenceProcessorPhaseTimes::set_ref_cleared(ReferenceType ref_type, size_t count) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   290
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   291
  _ref_cleared[ref_type_2_index(ref_type)] = count;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   292
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   293
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   294
size_t ReferenceProcessorPhaseTimes::ref_discovered(ReferenceType ref_type) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   295
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   296
  return _ref_discovered[ref_type_2_index(ref_type)];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   297
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   298
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   299
void ReferenceProcessorPhaseTimes::set_ref_discovered(ReferenceType ref_type, size_t count) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   300
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   301
  _ref_discovered[ref_type_2_index(ref_type)] = count;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   302
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   303
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   304
size_t ReferenceProcessorPhaseTimes::ref_enqueued(ReferenceType ref_type) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   305
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   306
  return _ref_enqueued[ref_type_2_index(ref_type)];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   307
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   308
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   309
void ReferenceProcessorPhaseTimes::set_ref_enqueued(ReferenceType ref_type, size_t count) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   310
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   311
  _ref_enqueued[ref_type_2_index(ref_type)] = count;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   312
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   313
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   314
double ReferenceProcessorPhaseTimes::balance_queues_time_ms(ReferenceType ref_type) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   315
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   316
  return _balance_queues_time_ms[ref_type_2_index(ref_type)];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   317
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   318
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   319
void ReferenceProcessorPhaseTimes::set_balance_queues_time_ms(ReferenceType ref_type, double time_ms) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   320
  ASSERT_REF_TYPE(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   321
  _balance_queues_time_ms[ref_type_2_index(ref_type)] = time_ms;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   322
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   323
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   324
ReferenceProcessorPhaseTimes::RefProcParPhases
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   325
ReferenceProcessorPhaseTimes::par_phase(RefProcPhaseNumbers phase_number) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   326
  ASSERT_PHASE_NUMBER(phase_number);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   327
  ASSERT_REF_TYPE(_processing_ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   328
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   329
  int result = SoftRefPhase1;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   330
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   331
  switch(_processing_ref_type) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   332
    case REF_SOFT:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   333
      result = (int)SoftRefPhase1;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   334
      result += phase_number;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   335
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   336
      assert((RefProcParPhases)result >= SoftRefPhase1 &&
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   337
             (RefProcParPhases)result <= SoftRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   338
             "Invariant (%d)", result);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   339
      break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   340
    case REF_WEAK:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   341
      result = (int)WeakRefPhase2;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   342
      result += (phase_number - 1);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   343
      assert((RefProcParPhases)result >= WeakRefPhase2 &&
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   344
             (RefProcParPhases)result <= WeakRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   345
             "Invariant (%d)", result);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   346
      break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   347
    case REF_FINAL:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   348
      result = (int)FinalRefPhase2;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   349
      result += (phase_number - 1);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   350
      assert((RefProcParPhases)result >= FinalRefPhase2 &&
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   351
             (RefProcParPhases)result <= FinalRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   352
             "Invariant (%d)", result);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   353
      break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   354
    case REF_PHANTOM:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   355
      result = (int)PhantomRefPhase2;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   356
      result += (phase_number - 1);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   357
      assert((RefProcParPhases)result >= PhantomRefPhase2 &&
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   358
             (RefProcParPhases)result <= PhantomRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   359
             "Invariant (%d)", result);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   360
      break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   361
    default:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   362
      ShouldNotReachHere();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   363
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   364
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   365
  ASSERT_PAR_PHASE(result);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   366
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   367
  return (RefProcParPhases)result;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   368
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   369
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   370
void ReferenceProcessorPhaseTimes::print_enqueue_phase(uint base_indent, bool print_total) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   371
  if (print_total) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   372
    print_phase(RefEnqueue, base_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   373
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   374
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   375
  log_debug(gc, phases, ref)("%sReference Counts:  Soft: " SIZE_FORMAT "  Weak: " SIZE_FORMAT
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   376
                             "  Final: " SIZE_FORMAT "  Phantom: " SIZE_FORMAT ,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   377
                             Indents[base_indent + 1], ref_enqueued(REF_SOFT), ref_enqueued(REF_WEAK),
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   378
                             ref_enqueued(REF_FINAL), ref_enqueued(REF_PHANTOM));
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   379
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   380
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   381
#define TIME_FORMAT "%.1lfms"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   382
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   383
void ReferenceProcessorPhaseTimes::print_all_references(uint base_indent, bool print_total) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   384
  if (print_total) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   385
    LogTarget(Debug, gc, phases, ref) lt;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   386
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   387
    if (lt.is_enabled()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   388
      LogStream ls(lt);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   389
      ls.print_cr("%s%s: " TIME_FORMAT,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   390
                  Indents[base_indent], "Reference Processing", total_time_ms());
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   391
    }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   392
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   393
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   394
  uint next_indent = base_indent + 1;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   395
  print_reference(REF_SOFT, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   396
  print_reference(REF_WEAK, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   397
  print_reference(REF_FINAL, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   398
  print_reference(REF_PHANTOM, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   399
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   400
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   401
void ReferenceProcessorPhaseTimes::print_reference(ReferenceType ref_type, uint base_indent) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   402
  LogTarget(Debug, gc, phases, ref) lt;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   403
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   404
  if (lt.is_enabled()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   405
    LogStream ls(lt);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   406
    uint next_indent = base_indent + 1;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   407
    ResourceMark rm;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   408
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   409
    ls.print_cr("%s%s: " TIME_FORMAT,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   410
                Indents[base_indent], ref_type_2_string(ref_type), ref_proc_time_ms(ref_type));
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   411
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   412
    double balance_time = balance_queues_time_ms(ref_type);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   413
    if (balance_time != uninitialized()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   414
      ls.print_cr("%s%s " TIME_FORMAT, Indents[next_indent], "Balance queues:", balance_time);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   415
    }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   416
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   417
    switch(ref_type) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   418
      case REF_SOFT:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   419
        print_phase(SoftRefPhase1, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   420
        print_phase(SoftRefPhase2, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   421
        print_phase(SoftRefPhase3, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   422
        break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   423
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   424
      case REF_WEAK:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   425
        print_phase(WeakRefPhase2, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   426
        print_phase(WeakRefPhase3, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   427
        break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   428
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   429
      case REF_FINAL:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   430
        print_phase(FinalRefPhase2, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   431
        print_phase(FinalRefPhase3, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   432
        break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   433
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   434
      case REF_PHANTOM:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   435
        print_phase(PhantomRefPhase2, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   436
        print_phase(PhantomRefPhase3, next_indent);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   437
        break;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   438
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   439
      default:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   440
        ShouldNotReachHere();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   441
    }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   442
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   443
    ls.print_cr("%s%s " SIZE_FORMAT, Indents[next_indent], "Discovered:", ref_discovered(ref_type));
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   444
    ls.print_cr("%s%s " SIZE_FORMAT, Indents[next_indent], "Cleared:", ref_cleared(ref_type));
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   445
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   446
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   447
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   448
void ReferenceProcessorPhaseTimes::print_phase(RefProcParPhases phase, uint indent) const {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   449
  double phase_time = par_phase_time_ms(phase);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   450
  if (phase_time != uninitialized()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   451
    LogTarget(Debug, gc, phases, ref) lt;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   452
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   453
    LogStream ls(lt);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   454
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   455
    ls.print_cr("%s%s%s " TIME_FORMAT,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   456
                Indents[indent],
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   457
                phase_enum_2_phase_string(phase),
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   458
                indent == 0 ? "" : ":", /* 0 indent logs don't need colon. */
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   459
                phase_time);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   460
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   461
    LogTarget(Trace, gc, phases, ref) lt2;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   462
    if (_processing_is_mt && lt2.is_enabled()) {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   463
      LogStream ls(lt2);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   464
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   465
      ls.print("%s", Indents[indent + 1]);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   466
      // worker_time_sec is recorded in seconds but it will be printed in milliseconds.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   467
      worker_time_sec(phase)->print_summary_on(&ls, true);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   468
    }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   469
  }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   470
}
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   471
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   472
#undef ASSERT_REF_TYPE
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   473
#undef ASSERT_PHASE_NUMBER
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   474
#undef ASSERT_PAR_PHASE
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   475
#undef TIME_FORMAT