hotspot/src/share/vm/gc/g1/g1StringDedupStat.hpp
author jprovino
Tue, 02 Aug 2016 16:39:33 -0400
changeset 40328 a2851f5f1cf6
parent 39690 09a3ee292336
permissions -rw-r--r--
8071770: G1 does not implement millis_since_last_gc which is needed by RMI GC Summary: G1 does not return a correct value for the CollectedHeap::millis_since_last_gc Reviewed-by: jmasa, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     1
/*
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     4
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     8
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    13
 * accompanied this code).
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    14
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    18
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    21
 * questions.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    22
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    23
 */
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 23472
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1STRINGDEDUPSTAT_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 23472
diff changeset
    26
#define SHARE_VM_GC_G1_G1STRINGDEDUPSTAT_HPP
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    27
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    28
#include "memory/allocation.hpp"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    29
#include "runtime/os.hpp"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    30
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    31
// Macros for GC log output formating
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    32
#define G1_STRDEDUP_OBJECTS_FORMAT         UINTX_FORMAT_W(12)
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    33
#define G1_STRDEDUP_TIME_FORMAT            "%.3fs"
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    34
#define G1_STRDEDUP_TIME_PARAM(time)       (time)
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    35
#define G1_STRDEDUP_TIME_FORMAT_MS         "%.3fms"
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    36
#define G1_STRDEDUP_TIME_PARAM_MS(time)    ((time) * MILLIUNITS)
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    37
#define G1_STRDEDUP_PERCENT_FORMAT         "%5.1f%%"
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    38
#define G1_STRDEDUP_PERCENT_FORMAT_NS      "%.1f%%"
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    39
#define G1_STRDEDUP_BYTES_FORMAT           "%8.1f%s"
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    40
#define G1_STRDEDUP_BYTES_FORMAT_NS        "%.1f%s"
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    41
#define G1_STRDEDUP_BYTES_PARAM(bytes)     byte_size_in_proper_unit((double)(bytes)), proper_unit_for_byte_size((bytes))
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    42
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    43
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    44
// Statistics gathered by the deduplication thread.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    45
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    46
class G1StringDedupStat : public StackObj {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    47
private:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    48
  // Counters
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    49
  uintx  _inspected;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    50
  uintx  _skipped;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    51
  uintx  _hashed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    52
  uintx  _known;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    53
  uintx  _new;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    54
  uintx  _new_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    55
  uintx  _deduped;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    56
  uintx  _deduped_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    57
  uintx  _deduped_young;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    58
  uintx  _deduped_young_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    59
  uintx  _deduped_old;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    60
  uintx  _deduped_old_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    61
  uintx  _idle;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    62
  uintx  _exec;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    63
  uintx  _block;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    64
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    65
  // Time spent by the deduplication thread in different phases
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    66
  double _start_concurrent;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    67
  double _end_concurrent;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
    68
  double _start_phase;
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    69
  double _idle_elapsed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    70
  double _exec_elapsed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    71
  double _block_elapsed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    72
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    73
public:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    74
  G1StringDedupStat();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    75
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    76
  void inc_inspected() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    77
    _inspected++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    78
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    79
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    80
  void inc_skipped() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    81
    _skipped++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    82
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    83
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    84
  void inc_hashed() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    85
    _hashed++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    86
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    87
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    88
  void inc_known() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    89
    _known++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    90
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    91
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    92
  void inc_new(uintx bytes) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    93
    _new++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    94
    _new_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    95
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    96
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    97
  void inc_deduped_young(uintx bytes) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    98
    _deduped++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    99
    _deduped_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   100
    _deduped_young++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   101
    _deduped_young_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   102
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   103
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   104
  void inc_deduped_old(uintx bytes) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   105
    _deduped++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   106
    _deduped_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   107
    _deduped_old++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   108
    _deduped_old_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   109
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   110
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   111
  void mark_idle() {
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   112
    _start_phase = os::elapsedTime();
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   113
    _idle++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   114
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   115
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   116
  void mark_exec() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   117
    double now = os::elapsedTime();
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   118
    _idle_elapsed = now - _start_phase;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   119
    _start_phase = now;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   120
    _start_concurrent = now;
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   121
    _exec++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   122
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   123
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   124
  void mark_block() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   125
    double now = os::elapsedTime();
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   126
    _exec_elapsed += now - _start_phase;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   127
    _start_phase = now;
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   128
    _block++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   129
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   130
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   131
  void mark_unblock() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   132
    double now = os::elapsedTime();
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   133
    _block_elapsed += now - _start_phase;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   134
    _start_phase = now;
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   135
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   136
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   137
  void mark_done() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   138
    double now = os::elapsedTime();
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   139
    _exec_elapsed += now - _start_phase;
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   140
    _end_concurrent = now;
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   141
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   142
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   143
  void add(const G1StringDedupStat& stat);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   144
39690
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   145
  static void print_start(const G1StringDedupStat& last_stat);
09a3ee292336 8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents: 35061
diff changeset
   146
  static void print_end(const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat);
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30764
diff changeset
   147
  static void print_statistics(const G1StringDedupStat& stat, bool total);
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   148
};
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   149
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 23472
diff changeset
   150
#endif // SHARE_VM_GC_G1_G1STRINGDEDUPSTAT_HPP