src/hotspot/share/gc/shared/gcTraceSend.cpp
author stefank
Thu, 22 Feb 2018 18:36:32 +0100
changeset 49048 4e8c86b75428
parent 47216 71c04702a3d5
child 49982 9042ffe5b7fe
permissions -rw-r--r--
8198525: Move _size_policy out of GenCollectorPolicy into GenCollectedHeap Reviewed-by: pliden, sjohanss
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: 41076
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
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    26
#include "gc/shared/copyFailedInfo.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    27
#include "gc/shared/gcHeapSummary.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    28
#include "gc/shared/gcTimer.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    29
#include "gc/shared/gcTrace.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    30
#include "gc/shared/gcWhen.hpp"
19729
0ddd2b7bb9bd 8020692: TestGCEventMixed.java failed because of timestamp in event after end event
ehelin
parents: 18704
diff changeset
    31
#include "runtime/os.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    32
#include "trace/traceBackend.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    33
#include "trace/tracing.hpp"
27684
e0391b2bf625 8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents: 25350
diff changeset
    34
#include "utilities/macros.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    35
#if INCLUDE_ALL_GCS
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    36
#include "gc/g1/evacuationInfo.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28024
diff changeset
    37
#include "gc/g1/g1YCTypes.hpp"
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
    38
#include "tracefiles/traceEventClasses.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    39
#endif
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    40
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    41
// All GC dependencies against the trace framework is contained within this file.
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
typedef uintptr_t TraceAddress;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    44
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    45
void GCTracer::send_garbage_collection_event() const {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
    46
  EventGarbageCollection event(UNTIMED);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    47
  if (event.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
    48
    event.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    49
    event.set_name(_shared_gc_info.name());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    50
    event.set_cause((u2) _shared_gc_info.cause());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    51
    event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    52
    event.set_longestPause(_shared_gc_info.longest_pause());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    53
    event.set_starttime(_shared_gc_info.start_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    54
    event.set_endtime(_shared_gc_info.end_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    55
    event.commit();
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
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    58
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    59
void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const {
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
    60
  EventGCReferenceStatistics e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    61
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
    62
      e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    63
      e.set_type((u1)type);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    64
      e.set_count(count);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    65
      e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    66
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    67
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    68
23470
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    69
void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype,
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    70
                                                      const MetaspaceChunkFreeListSummary& summary) const {
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    71
  EventMetaspaceChunkFreeListSummary e;
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    72
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
    73
    e.set_gcId(GCId::current());
23470
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    74
    e.set_when(when);
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    75
    e.set_metadataType(mdtype);
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    76
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    77
    e.set_specializedChunks(summary.num_specialized_chunks());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    78
    e.set_specializedChunksTotalSize(summary.specialized_chunks_size_in_bytes());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    79
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    80
    e.set_smallChunks(summary.num_small_chunks());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    81
    e.set_smallChunksTotalSize(summary.small_chunks_size_in_bytes());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    82
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    83
    e.set_mediumChunks(summary.num_medium_chunks());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    84
    e.set_mediumChunksTotalSize(summary.medium_chunks_size_in_bytes());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    85
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    86
    e.set_humongousChunks(summary.num_humongous_chunks());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    87
    e.set_humongousChunksTotalSize(summary.humongous_chunks_size_in_bytes());
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    88
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    89
    e.commit();
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    90
  }
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    91
}
ff2a7ea4225d 8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents: 23464
diff changeset
    92
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    93
void ParallelOldTracer::send_parallel_old_event() const {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
    94
  EventParallelOldGarbageCollection e(UNTIMED);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    95
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
    96
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    97
    e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    98
    e.set_starttime(_shared_gc_info.start_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
    99
    e.set_endtime(_shared_gc_info.end_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   100
    e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   101
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   102
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   103
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   104
void YoungGCTracer::send_young_gc_event() const {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   105
  EventYoungGarbageCollection e(UNTIMED);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   106
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   107
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   108
    e.set_tenuringThreshold(_tenuring_threshold);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   109
    e.set_starttime(_shared_gc_info.start_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   110
    e.set_endtime(_shared_gc_info.end_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   111
    e.commit();
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
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   114
28024
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   115
bool YoungGCTracer::should_send_promotion_in_new_plab_event() const {
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   116
  return EventPromoteObjectInNewPLAB::is_enabled();
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   117
}
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   118
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   119
bool YoungGCTracer::should_send_promotion_outside_plab_event() const {
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   120
  return EventPromoteObjectOutsidePLAB::is_enabled();
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   121
}
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   122
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   123
void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   124
                                                     uint age, bool tenured,
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   125
                                                     size_t plab_size) const {
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   126
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   127
  EventPromoteObjectInNewPLAB event;
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   128
  if (event.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   129
    event.set_gcId(GCId::current());
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   130
    event.set_objectClass(klass);
28024
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   131
    event.set_objectSize(obj_size);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   132
    event.set_tenured(tenured);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   133
    event.set_tenuringAge(age);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   134
    event.set_plabSize(plab_size);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   135
    event.commit();
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   136
  }
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   137
}
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   138
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   139
void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   140
                                                      uint age, bool tenured) const {
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   141
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   142
  EventPromoteObjectOutsidePLAB event;
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   143
  if (event.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   144
    event.set_gcId(GCId::current());
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   145
    event.set_objectClass(klass);
28024
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   146
    event.set_objectSize(obj_size);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   147
    event.set_tenured(tenured);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   148
    event.set_tenuringAge(age);
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   149
    event.commit();
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   150
  }
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   151
}
33102d6e1f06 8066441: Add PLAB trace event
sfriberg
parents: 27684
diff changeset
   152
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   153
void OldGCTracer::send_old_gc_event() const {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   154
  EventOldGarbageCollection e(UNTIMED);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   155
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   156
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   157
    e.set_starttime(_shared_gc_info.start_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   158
    e.set_endtime(_shared_gc_info.end_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   159
    e.commit();
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
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   162
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   163
static TraceStructCopyFailed to_trace_struct(const CopyFailedInfo& cf_info) {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   164
  TraceStructCopyFailed failed_info;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   165
  failed_info.set_objectCount(cf_info.failed_count());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   166
  failed_info.set_firstSize(cf_info.first_size());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   167
  failed_info.set_smallestSize(cf_info.smallest_size());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   168
  failed_info.set_totalSize(cf_info.total_size());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   169
  return failed_info;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   170
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   171
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   172
void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
   173
  EventPromotionFailed e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   174
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   175
    e.set_gcId(GCId::current());
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   176
    e.set_promotionFailed(to_trace_struct(pf_info));
36384
b0b41336a9a8 8143226: Minor updates to Event Based tracing
mgronlun
parents: 36095
diff changeset
   177
    e.set_thread(pf_info.thread_trace_id());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   178
    e.commit();
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
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   181
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   182
// Common to CMS and G1
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   183
void OldGCTracer::send_concurrent_mode_failure_event() {
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
   184
  EventConcurrentModeFailure e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   185
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   186
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   187
    e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   188
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   189
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   190
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   191
#if INCLUDE_ALL_GCS
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   192
void G1NewTracer::send_g1_young_gc_event() {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   193
  EventG1GarbageCollection e(UNTIMED);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   194
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   195
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   196
    e.set_type(_g1_young_gc_info.type());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   197
    e.set_starttime(_shared_gc_info.start_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   198
    e.set_endtime(_shared_gc_info.end_timestamp());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   199
    e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   200
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   201
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   202
41076
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   203
void G1MMUTracer::send_g1_mmu_event(double time_slice_ms, double gc_time_ms, double max_time_ms) {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   204
  EventG1MMU e;
31619
f27b8fcf4018 8078901: Add trace event for G1 MMU information
sjohanss
parents: 31344
diff changeset
   205
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   206
    e.set_gcId(GCId::current());
41076
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   207
    e.set_timeSlice(time_slice_ms);
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   208
    e.set_gcTime(gc_time_ms);
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   209
    e.set_pauseTarget(max_time_ms);
31619
f27b8fcf4018 8078901: Add trace event for G1 MMU information
sjohanss
parents: 31344
diff changeset
   210
    e.commit();
f27b8fcf4018 8078901: Add trace event for G1 MMU information
sjohanss
parents: 31344
diff changeset
   211
  }
f27b8fcf4018 8078901: Add trace event for G1 MMU information
sjohanss
parents: 31344
diff changeset
   212
}
f27b8fcf4018 8078901: Add trace event for G1 MMU information
sjohanss
parents: 31344
diff changeset
   213
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   214
void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   215
  EventEvacuationInformation e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   216
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   217
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   218
    e.set_cSetRegions(info->collectionset_regions());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   219
    e.set_cSetUsedBefore(info->collectionset_used_before());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   220
    e.set_cSetUsedAfter(info->collectionset_used_after());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   221
    e.set_allocationRegions(info->allocation_regions());
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   222
    e.set_allocationRegionsUsedBefore(info->alloc_regions_used_before());
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   223
    e.set_allocationRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   224
    e.set_bytesCopied(info->bytes_copied());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   225
    e.set_regionsFreed(info->regions_freed());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   226
    e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   227
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   228
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   229
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   230
void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
   231
  EventEvacuationFailed e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   232
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   233
    e.set_gcId(GCId::current());
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   234
    e.set_evacuationFailed(to_trace_struct(ef_info));
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   235
    e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   236
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   237
}
32380
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   238
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   239
static TraceStructG1EvacuationStatistics
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   240
create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   241
  TraceStructG1EvacuationStatistics s;
32380
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   242
  s.set_gcId(gcid);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   243
  s.set_allocated(summary.allocated() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   244
  s.set_wasted(summary.wasted() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   245
  s.set_used(summary.used() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   246
  s.set_undoWaste(summary.undo_wasted() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   247
  s.set_regionEndWaste(summary.region_end_waste() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   248
  s.set_regionsRefilled(summary.regions_filled());
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   249
  s.set_directAllocated(summary.direct_allocated() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   250
  s.set_failureUsed(summary.failure_used() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   251
  s.set_failureWaste(summary.failure_waste() * HeapWordSize);
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   252
  return s;
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   253
}
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   254
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   255
void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   256
  EventG1EvacuationYoungStatistics surv_evt;
32380
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   257
  if (surv_evt.should_commit()) {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   258
    surv_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
32380
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   259
    surv_evt.commit();
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   260
  }
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   261
}
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   262
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   263
void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   264
  EventG1EvacuationOldStatistics old_evt;
32380
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   265
  if (old_evt.should_commit()) {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   266
    old_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
32380
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   267
    old_evt.commit();
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   268
  }
1dcdb686f0cb 8133530: Add JFR event for evacuation statistics
tschatzl
parents: 31619
diff changeset
   269
}
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   270
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   271
void G1NewTracer::send_basic_ihop_statistics(size_t threshold,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   272
                                             size_t target_occupancy,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   273
                                             size_t current_occupancy,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   274
                                             size_t last_allocation_size,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   275
                                             double last_allocation_duration,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   276
                                             double last_marking_length) {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   277
  EventG1BasicIHOP evt;
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   278
  if (evt.should_commit()) {
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   279
    evt.set_gcId(GCId::current());
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   280
    evt.set_threshold(threshold);
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   281
    evt.set_targetOccupancy(target_occupancy);
39980
dcef6760667c 8157459: G1 IHOP JFR event attribute with incorrect content type
tschatzl
parents: 36384
diff changeset
   282
    evt.set_thresholdPercentage(target_occupancy > 0 ? ((double)threshold / target_occupancy) : 0.0);
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   283
    evt.set_currentOccupancy(current_occupancy);
41076
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   284
    evt.set_recentMutatorAllocationSize(last_allocation_size);
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   285
    evt.set_recentMutatorDuration(last_allocation_duration * MILLIUNITS);
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   286
    evt.set_recentAllocationRate(last_allocation_duration != 0.0 ? last_allocation_size / last_allocation_duration : 0.0);
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   287
    evt.set_lastMarkingDuration(last_marking_length * MILLIUNITS);
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   288
    evt.commit();
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   289
  }
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   290
}
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   291
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   292
void G1NewTracer::send_adaptive_ihop_statistics(size_t threshold,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   293
                                                size_t internal_target_occupancy,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   294
                                                size_t current_occupancy,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   295
                                                size_t additional_buffer_size,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   296
                                                double predicted_allocation_rate,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   297
                                                double predicted_marking_length,
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   298
                                                bool prediction_active) {
40664
1ec65b303bb7 8164523: Clean up metadata for event based tracing
egahlin
parents: 39980
diff changeset
   299
  EventG1AdaptiveIHOP evt;
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   300
  if (evt.should_commit()) {
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   301
    evt.set_gcId(GCId::current());
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   302
    evt.set_threshold(threshold);
39980
dcef6760667c 8157459: G1 IHOP JFR event attribute with incorrect content type
tschatzl
parents: 36384
diff changeset
   303
    evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0);
41076
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   304
    evt.set_ihopTargetOccupancy(internal_target_occupancy);
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   305
    evt.set_currentOccupancy(current_occupancy);
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   306
    evt.set_additionalBufferSize(additional_buffer_size);
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   307
    evt.set_predictedAllocationRate(predicted_allocation_rate);
41076
8c6aa0873dd1 8165455: Tracing events for G1 have incorrect metadata
ehelin
parents: 40664
diff changeset
   308
    evt.set_predictedMarkingDuration(predicted_marking_length * MILLIUNITS);
34300
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   309
    evt.set_predictionActive(prediction_active);
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   310
    evt.commit();
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   311
  }
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   312
}
6075c1e0e913 8136679: JFR event for adaptive IHOP
tschatzl
parents: 33107
diff changeset
   313
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   314
#endif
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   315
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   316
static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   317
  TraceStructVirtualSpace space;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   318
  space.set_start((TraceAddress)summary.start());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   319
  space.set_committedEnd((TraceAddress)summary.committed_end());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   320
  space.set_committedSize(summary.committed_size());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   321
  space.set_reservedEnd((TraceAddress)summary.reserved_end());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   322
  space.set_reservedSize(summary.reserved_size());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   323
  return space;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   324
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   325
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   326
static TraceStructObjectSpace to_trace_struct(const SpaceSummary& summary) {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   327
  TraceStructObjectSpace space;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   328
  space.set_start((TraceAddress)summary.start());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   329
  space.set_end((TraceAddress)summary.end());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   330
  space.set_used(summary.used());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   331
  space.set_size(summary.size());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   332
  return space;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   333
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   334
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   335
class GCHeapSummaryEventSender : public GCHeapSummaryVisitor {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   336
  GCWhen::Type _when;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   337
 public:
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   338
  GCHeapSummaryEventSender(GCWhen::Type when) : _when(when) {}
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   339
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   340
  void visit(const GCHeapSummary* heap_summary) const {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   341
    const VirtualSpaceSummary& heap_space = heap_summary->heap();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   342
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
   343
    EventGCHeapSummary e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   344
    if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   345
      e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   346
      e.set_when((u1)_when);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   347
      e.set_heapSpace(to_trace_struct(heap_space));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   348
      e.set_heapUsed(heap_summary->used());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   349
      e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   350
    }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   351
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   352
31344
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   353
  void visit(const G1HeapSummary* g1_heap_summary) const {
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   354
    visit((GCHeapSummary*)g1_heap_summary);
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   355
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   356
    EventG1HeapSummary e;
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   357
    if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   358
      e.set_gcId(GCId::current());
31344
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   359
      e.set_when((u1)_when);
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   360
      e.set_edenUsedSize(g1_heap_summary->edenUsed());
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   361
      e.set_edenTotalSize(g1_heap_summary->edenCapacity());
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   362
      e.set_survivorUsedSize(g1_heap_summary->survivorUsed());
36095
2d530b26ae5c 8149648: Add number of regions to the G1HeapSummary event
david
parents: 35204
diff changeset
   363
      e.set_numberOfRegions(g1_heap_summary->numberOfRegions());
31344
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   364
      e.commit();
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   365
    }
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   366
  }
2316eb7a0358 8025608: GC trace events missing nursery size information
david
parents: 30764
diff changeset
   367
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   368
  void visit(const PSHeapSummary* ps_heap_summary) const {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   369
    visit((GCHeapSummary*)ps_heap_summary);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   370
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   371
    const VirtualSpaceSummary& old_summary = ps_heap_summary->old();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   372
    const SpaceSummary& old_space = ps_heap_summary->old_space();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   373
    const VirtualSpaceSummary& young_summary = ps_heap_summary->young();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   374
    const SpaceSummary& eden_space = ps_heap_summary->eden();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   375
    const SpaceSummary& from_space = ps_heap_summary->from();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   376
    const SpaceSummary& to_space = ps_heap_summary->to();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   377
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
   378
    EventPSHeapSummary e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   379
    if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   380
      e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   381
      e.set_when((u1)_when);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   382
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   383
      e.set_oldSpace(to_trace_struct(ps_heap_summary->old()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   384
      e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   385
      e.set_youngSpace(to_trace_struct(ps_heap_summary->young()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   386
      e.set_edenSpace(to_trace_struct(ps_heap_summary->eden()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   387
      e.set_fromSpace(to_trace_struct(ps_heap_summary->from()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   388
      e.set_toSpace(to_trace_struct(ps_heap_summary->to()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   389
      e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   390
    }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   391
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   392
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   393
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   394
void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   395
  GCHeapSummaryEventSender visitor(when);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   396
  heap_summary.accept(&visitor);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   397
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   398
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   399
static TraceStructMetaspaceSizes to_trace_struct(const MetaspaceSizes& sizes) {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   400
  TraceStructMetaspaceSizes meta_sizes;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   401
23853
3e1633ff6996 8035667: EventMetaspaceSummary doesn't report committed Metaspace memory
ehelin
parents: 23470
diff changeset
   402
  meta_sizes.set_committed(sizes.committed());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   403
  meta_sizes.set_used(sizes.used());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   404
  meta_sizes.set_reserved(sizes.reserved());
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   405
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   406
  return meta_sizes;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   407
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   408
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   409
void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 19729
diff changeset
   410
  EventMetaspaceSummary e;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   411
  if (e.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   412
    e.set_gcId(GCId::current());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   413
    e.set_when((u1) when);
23464
ae470a2efd44 8036696: Add metaspace gc threshold to metaspace summary trace event
ehelin
parents: 21767
diff changeset
   414
    e.set_gcThreshold(meta_space_summary.capacity_until_GC());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   415
    e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   416
    e.set_dataSpace(to_trace_struct(meta_space_summary.data_space()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   417
    e.set_classSpace(to_trace_struct(meta_space_summary.class_space()));
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   418
    e.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   419
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   420
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   421
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   422
class PhaseSender : public PhaseVisitor {
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   423
  void visit_pause(GCPhase* phase) {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   424
    assert(phase->level() < PhasesStack::PHASE_LEVELS, "Need more event types for PausePhase");
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   425
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   426
    switch (phase->level()) {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   427
      case 0: send_phase<EventGCPhasePause>(phase); break;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   428
      case 1: send_phase<EventGCPhasePauseLevel1>(phase); break;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   429
      case 2: send_phase<EventGCPhasePauseLevel2>(phase); break;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   430
      case 3: send_phase<EventGCPhasePauseLevel3>(phase); break;
46795
623a5e42deb6 8173335: Improve logging for j.l.ref.reference processing
sangheki
parents: 41076
diff changeset
   431
      case 4: send_phase<EventGCPhasePauseLevel4>(phase); break;
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   432
      default: /* Ignore sending this phase */ break;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   433
    }
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   434
  }
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   435
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   436
  void visit_concurrent(GCPhase* phase) {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   437
    assert(phase->level() < 1, "There is only one level for ConcurrentPhase");
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   438
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   439
    switch (phase->level()) {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   440
      case 0: send_phase<EventGCPhaseConcurrent>(phase); break;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   441
      default: /* Ignore sending this phase */ break;
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   442
    }
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   443
  }
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   444
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   445
 public:
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   446
  template<typename T>
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   447
  void send_phase(GCPhase* phase) {
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   448
    T event(UNTIMED);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   449
    if (event.should_commit()) {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   450
      event.set_gcId(GCId::current());
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   451
      event.set_name(phase->name());
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   452
      event.set_starttime(phase->start());
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   453
      event.set_endtime(phase->end());
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   454
      event.commit();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   455
    }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   456
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   457
35204
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   458
  void visit(GCPhase* phase) {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   459
    if (phase->type() == GCPhase::PausePhaseType) {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   460
      visit_pause(phase);
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   461
    } else {
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   462
      assert(phase->type() == GCPhase::ConcurrentPhaseType, "Should be ConcurrentPhaseType");
78a0fd90a70f 8068394: Trace event for concurrent GC phases
sangheki
parents: 35196
diff changeset
   463
      visit_concurrent(phase);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   464
    }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   465
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   466
};
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   467
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   468
void GCTracer::send_phase_events(TimePartitions* time_partitions) const {
33107
77bf0d2069a3 8134953: Make the GC ID available in a central place
brutisso
parents: 32380
diff changeset
   469
  PhaseSender phase_reporter;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   470
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   471
  TimePartitionPhasesIterator iter(time_partitions);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   472
  while (iter.has_next()) {
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   473
    GCPhase* phase = iter.next();
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   474
    phase->accept(&phase_reporter);
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   475
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents:
diff changeset
   476
}