src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.hpp
author stefank
Thu, 22 Feb 2018 18:36:07 +0100
changeset 49047 8f004146e407
parent 47216 71c04702a3d5
child 49360 886acec3b4c6
permissions -rw-r--r--
8198515: Extract SoftReferencePolicy code out of CollectorPolicy Reviewed-by: pliden, sjohanss
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
#ifndef SHARE_VM_GC_SHARED_REFERENCEPROCESSORPHASETIMES_HPP
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    26
#define SHARE_VM_GC_SHARED_REFERENCEPROCESSORPHASETIMES_HPP
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    27
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    28
#include "gc/shared/referenceProcessorStats.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    29
#include "gc/shared/workerDataArray.inline.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    30
#include "memory/referenceType.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    31
#include "utilities/ticks.hpp"
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    32
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    33
class DiscoveredList;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    34
class GCTimer;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    35
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    36
class ReferenceProcessorPhaseTimes : public CHeapObj<mtGC> {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    37
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    38
  // Detailed phases that has parallel work.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    39
  enum RefProcParPhases {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    40
    SoftRefPhase1,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    41
    SoftRefPhase2,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    42
    SoftRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    43
    WeakRefPhase2,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    44
    WeakRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    45
    FinalRefPhase2,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    46
    FinalRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    47
    PhantomRefPhase2,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    48
    PhantomRefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    49
    RefEnqueue,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    50
    RefParPhaseMax
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    51
  };
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
  // Sub-phases that are used when processing each j.l.Reference types.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    54
  // Only SoftReference has RefPhase1.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    55
  enum RefProcPhaseNumbers {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    56
    RefPhase1,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    57
    RefPhase2,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    58
    RefPhase3,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    59
    RefPhaseMax
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    60
  };
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    61
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    62
private:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    63
  static const int number_of_subclasses_of_ref = REF_PHANTOM - REF_OTHER; // 5 - 1 = 4
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
  // Records per thread information of each phase.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    66
  WorkerDataArray<double>* _worker_time_sec[RefParPhaseMax];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    67
  // Records elapsed time of each phase.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    68
  double                   _par_phase_time_ms[RefParPhaseMax];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    69
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    70
  // Total spent time for references.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    71
  // e.g. _ref_proc_time_ms[0] = _par_phase_time_ms[SoftRefPhase1] +
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    72
  //                             _par_phase_time_ms[SoftRefPhase2] +
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    73
  //                             _par_phase_time_ms[SoftRefPhase3] + extra time.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    74
  double                   _ref_proc_time_ms[number_of_subclasses_of_ref];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    75
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    76
  double                   _total_time_ms;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    77
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    78
  size_t                   _ref_cleared[number_of_subclasses_of_ref];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    79
  size_t                   _ref_discovered[number_of_subclasses_of_ref];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    80
  size_t                   _ref_enqueued[number_of_subclasses_of_ref];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    81
  double                   _balance_queues_time_ms[number_of_subclasses_of_ref];
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    82
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    83
  bool                     _processing_is_mt;
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
  // Currently processing reference type.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    86
  ReferenceType            _processing_ref_type;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    87
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    88
  GCTimer*                 _gc_timer;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    89
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    90
  double par_phase_time_ms(RefProcParPhases phase) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    91
  double ref_proc_time_ms(ReferenceType ref_type) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    92
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    93
  double total_time_ms() const { return _total_time_ms; }
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
  size_t ref_cleared(ReferenceType ref_type) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    96
  size_t ref_enqueued(ReferenceType ref_type) const;
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 balance_queues_time_ms(ReferenceType ref_type) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
    99
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   100
  void print_reference(ReferenceType ref_type, uint base_indent) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   101
  void print_phase(RefProcParPhases phase, uint indent) const;
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
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   104
  ReferenceProcessorPhaseTimes(GCTimer* gc_timer, uint max_gc_threads);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   105
  ~ReferenceProcessorPhaseTimes();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   106
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   107
  static double uninitialized() { return -1.0; }
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
  WorkerDataArray<double>* worker_time_sec(RefProcParPhases phase) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   110
  void set_par_phase_time_ms(RefProcParPhases phase, double par_phase_time_ms);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   111
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   112
  void set_ref_proc_time_ms(ReferenceType ref_type, double ref_proc_time_ms);
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
  void set_total_time_ms(double total_time_ms) { _total_time_ms = total_time_ms; }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   115
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   116
  void set_ref_cleared(ReferenceType ref_type, size_t count);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   117
  size_t ref_discovered(ReferenceType ref_type) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   118
  void set_ref_discovered(ReferenceType ref_type, size_t count);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   119
  void set_ref_enqueued(ReferenceType ref_type, size_t count);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   120
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   121
  void 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
   122
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   123
  void set_processing_is_mt(bool processing_is_mt) { _processing_is_mt = processing_is_mt; }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   124
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   125
  ReferenceType processing_ref_type() const { return _processing_ref_type; }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   126
  void set_processing_ref_type(ReferenceType processing_ref_type) { _processing_ref_type = processing_ref_type; }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   127
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   128
  // Returns RefProcParPhases calculated from phase_number and _processing_ref_type.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   129
  RefProcParPhases par_phase(RefProcPhaseNumbers phase_number) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   130
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   131
  GCTimer* gc_timer() const { return _gc_timer; }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   132
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   133
  // Reset all fields. If not reset at next cycle, an assertion will fail.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   134
  void reset();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   135
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   136
  void print_enqueue_phase(uint base_indent = 0, bool print_total = true) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   137
  void print_all_references(uint base_indent = 0, bool print_total = true) const;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   138
};
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
// Updates working time of each worker thread.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   141
class RefProcWorkerTimeTracker : public StackObj {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   142
protected:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   143
  WorkerDataArray<double>* _worker_time;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   144
  double                   _start_time;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   145
  uint                     _worker_id;
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
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   148
  RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers number,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   149
                           ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   150
                           uint worker_id);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   151
  RefProcWorkerTimeTracker(ReferenceProcessorPhaseTimes::RefProcParPhases phase,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   152
                           ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   153
                           uint worker_id);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   154
  ~RefProcWorkerTimeTracker();
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
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   157
class RefProcPhaseTimeBaseTracker : public StackObj {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   158
protected:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   159
  const char*                   _title;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   160
  ReferenceProcessorPhaseTimes* _phase_times;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   161
  Ticks                         _start_ticks;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   162
  Ticks                         _end_ticks;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   163
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   164
  Ticks end_ticks();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   165
  double elapsed_time();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   166
  ReferenceProcessorPhaseTimes* phase_times() const { return _phase_times; }
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   167
  // Print phase elapsed time with each worker information if MT processed.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   168
  void print_phase(ReferenceProcessorPhaseTimes::RefProcParPhases phase, uint indent);
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
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   171
  RefProcPhaseTimeBaseTracker(const char* title,
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
  ~RefProcPhaseTimeBaseTracker();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   174
};
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   175
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   176
// Updates queue balance time at ReferenceProcessorPhaseTimes and
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   177
// save it into GCTimer.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   178
class RefProcBalanceQueuesTimeTracker : public RefProcPhaseTimeBaseTracker {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   179
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   180
  RefProcBalanceQueuesTimeTracker(ReferenceProcessorPhaseTimes* phase_times);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   181
  ~RefProcBalanceQueuesTimeTracker();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   182
};
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   183
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   184
// Updates phase time at ReferenceProcessorPhaseTimes and save it into GCTimer.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   185
class RefProcParPhaseTimeTracker : public RefProcPhaseTimeBaseTracker {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   186
  ReferenceProcessorPhaseTimes::RefProcPhaseNumbers _phase_number;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   187
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   188
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   189
  RefProcParPhaseTimeTracker(ReferenceProcessorPhaseTimes::RefProcPhaseNumbers phase_number,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   190
                             ReferenceProcessorPhaseTimes* phase_times);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   191
  ~RefProcParPhaseTimeTracker();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   192
};
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   193
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   194
// Updates phase time related information.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   195
// - Each phase processing time, cleared/discovered reference counts and stats for each working threads if MT processed.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   196
class RefProcPhaseTimesTracker : public RefProcPhaseTimeBaseTracker {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   197
  ReferenceProcessor* _rp;
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   198
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   199
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   200
  RefProcPhaseTimesTracker(ReferenceType ref_type,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   201
                           ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   202
                           ReferenceProcessor* rp);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   203
  ~RefProcPhaseTimesTracker();
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   204
};
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
// Updates enqueue time related information.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   207
// - Enqueueing time, enqueued reference count and stats for each working thread if MT processed.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   208
class RefProcEnqueueTimeTracker : public RefProcPhaseTimeBaseTracker {
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   209
public:
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   210
  RefProcEnqueueTimeTracker(ReferenceProcessorPhaseTimes* phase_times,
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   211
                            ReferenceProcessorStats& stats);
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff changeset
   212
  ~RefProcEnqueueTimeTracker();
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
#endif // SHARE_VM_GC_SHARED_REFERENCEPROCESSORPHASETIMES_HPP