src/hotspot/share/gc/shared/gcTimer.hpp
author shade
Thu, 30 Nov 2017 17:13:33 +0100
branchepsilon-gc-branch
changeset 55934 912c55e702d6
parent 47765 b7c7428eaab9
child 49020 6d61be5959e0
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     1
/*
46795
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents: 35529
diff changeset
     2
 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     4
 *
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     8
 *
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    13
 * accompanied this code).
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    14
 *
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    18
 *
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    21
 * questions.
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    22
 *
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    23
 */
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 21767
diff changeset
    25
#ifndef SHARE_VM_GC_SHARED_GCTIMER_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 21767
diff changeset
    26
#define SHARE_VM_GC_SHARED_GCTIMER_HPP
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    27
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    28
#include "memory/allocation.hpp"
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    29
#include "utilities/macros.hpp"
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    30
#include "utilities/ticks.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    31
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    32
class ConcurrentPhase;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    33
class GCPhase;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    34
class PausePhase;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    35
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    36
template <class E> class GrowableArray;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    37
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    38
class PhaseVisitor {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    39
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    40
  virtual void visit(GCPhase* phase) = 0;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    41
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    42
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    43
class GCPhase {
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    44
 public:
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    45
  enum PhaseType {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    46
    PausePhaseType      = 0,
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    47
    ConcurrentPhaseType = 1
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    48
  };
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    49
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    50
 private:
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    51
  const char* _name;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    52
  int _level;
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    53
  Ticks _start;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    54
  Ticks _end;
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    55
  PhaseType _type;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    56
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    57
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    58
  void set_name(const char* name) { _name = name; }
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    59
  const char* name() const { return _name; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    60
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    61
  int level() const { return _level; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    62
  void set_level(int level) { _level = level; }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    63
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    64
  const Ticks start() const { return _start; }
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    65
  void set_start(const Ticks& time) { _start = time; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    66
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    67
  const Ticks end() const { return _end; }
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
    68
  void set_end(const Ticks& time) { _end = time; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    69
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    70
  PhaseType type() const { return _type; }
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    71
  void set_type(PhaseType type) { _type = type; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    72
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    73
  void accept(PhaseVisitor* visitor) {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    74
    visitor->visit(this);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    75
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    76
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    77
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    78
class PhasesStack {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    79
 public:
46795
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents: 35529
diff changeset
    80
  // Set to 6, since Reference processing needs it.
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents: 35529
diff changeset
    81
  static const int PHASE_LEVELS = 6;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    82
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    83
 private:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    84
  int _phase_indices[PHASE_LEVELS];
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    85
  int _next_phase_level;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    86
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    87
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    88
  PhasesStack() { clear(); }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    89
  void clear();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    90
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    91
  void push(int phase_index);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    92
  int pop();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    93
  int count() const;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    94
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    95
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    96
class TimePartitions {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    97
  static const int INITIAL_CAPACITY = 10;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    98
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
    99
  GrowableArray<GCPhase>* _phases;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   100
  PhasesStack _active_phases;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   101
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   102
  Tickspan _sum_of_pauses;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   103
  Tickspan _longest_pause;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   104
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   105
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   106
  TimePartitions();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   107
  ~TimePartitions();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   108
  void clear();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   109
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   110
  void report_gc_phase_start(const char* name, const Ticks& time, GCPhase::PhaseType type=GCPhase::PausePhaseType);
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   111
  void report_gc_phase_end(const Ticks& time, GCPhase::PhaseType type=GCPhase::PausePhaseType);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   112
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   113
  int num_phases() const;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   114
  GCPhase* phase_at(int index) const;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   115
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   116
  const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   117
  const Tickspan longest_pause() const { return _longest_pause; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   118
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   119
  bool has_active_phases();
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   120
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   121
 private:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   122
  void update_statistics(GCPhase* phase);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   123
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   124
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   125
class PhasesIterator {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   126
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   127
  virtual bool has_next() = 0;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   128
  virtual GCPhase* next() = 0;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   129
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   130
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   131
class GCTimer : public ResourceObj {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   132
  NOT_PRODUCT(friend class GCTimerTest;)
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   133
 protected:
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   134
  Ticks _gc_start;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   135
  Ticks _gc_end;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   136
  TimePartitions _time_partitions;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   137
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   138
 public:
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   139
  virtual void register_gc_start(const Ticks& time = Ticks::now());
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   140
  virtual void register_gc_end(const Ticks& time = Ticks::now());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   141
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   142
  void register_gc_phase_start(const char* name, const Ticks& time);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   143
  void register_gc_phase_end(const Ticks& time);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   144
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   145
  const Ticks gc_start() const { return _gc_start; }
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   146
  const Ticks gc_end() const { return _gc_end; }
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   147
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   148
  TimePartitions* time_partitions() { return &_time_partitions; }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   149
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   150
 protected:
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   151
  void register_gc_pause_start(const char* name, const Ticks& time = Ticks::now());
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   152
  void register_gc_pause_end(const Ticks& time = Ticks::now());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   153
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   154
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   155
class STWGCTimer : public GCTimer {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   156
 public:
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   157
  virtual void register_gc_start(const Ticks& time = Ticks::now());
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   158
  virtual void register_gc_end(const Ticks& time = Ticks::now());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   159
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   160
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   161
class ConcurrentGCTimer : public GCTimer {
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   162
  // ConcurrentGCTimer can't be used if there is an overlap between a pause phase and a concurrent phase.
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   163
  // _is_concurrent_phase_active is used to find above case.
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   164
  bool _is_concurrent_phase_active;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   165
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   166
 public:
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   167
  ConcurrentGCTimer(): GCTimer(), _is_concurrent_phase_active(false) {};
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   168
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   169
  void register_gc_pause_start(const char* name);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 18025
diff changeset
   170
  void register_gc_pause_end();
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   171
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   172
  void register_gc_concurrent_start(const char* name, const Ticks& time = Ticks::now());
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 30764
diff changeset
   173
  void register_gc_concurrent_end(const Ticks& time = Ticks::now());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   174
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   175
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   176
class TimePartitionPhasesIterator {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   177
  TimePartitions* _time_partitions;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   178
  int _next;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   179
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   180
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   181
  TimePartitionPhasesIterator(TimePartitions* time_partitions) : _time_partitions(time_partitions), _next(0) { }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   182
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   183
  virtual bool has_next();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   184
  virtual GCPhase* next();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   185
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   186
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 21767
diff changeset
   187
#endif // SHARE_VM_GC_SHARED_GCTIMER_HPP