hotspot/src/share/vm/gc/g1/g1StringDedupStat.hpp
author brutisso
Thu, 10 Dec 2015 14:57:55 +0100
changeset 35061 be6025ebffea
parent 30764 fec48bf5a827
child 39690 09a3ee292336
permissions -rw-r--r--
8145092: Use Unified Logging for the GC logging Summary: JEP-271. VM changes contributed by brutisso, test changes contributed by david. Reviewed-by: sjohanss, david, brutisso Contributed-by: bengt.rutisson@oracle.com, david.lindholm@oralce.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 23472
diff changeset
     2
 * Copyright (c) 2014, 2015, 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)
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    33
#define G1_STRDEDUP_TIME_FORMAT            "%1.7lf secs"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    34
#define G1_STRDEDUP_PERCENT_FORMAT         "%5.1lf%%"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    35
#define G1_STRDEDUP_PERCENT_FORMAT_NS      "%.1lf%%"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    36
#define G1_STRDEDUP_BYTES_FORMAT           "%8.1lf%s"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    37
#define G1_STRDEDUP_BYTES_FORMAT_NS        "%.1lf%s"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    38
#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
    39
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    40
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    41
// Statistics gathered by the deduplication thread.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    42
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    43
class G1StringDedupStat : public StackObj {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    44
private:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    45
  // Counters
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    46
  uintx  _inspected;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    47
  uintx  _skipped;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    48
  uintx  _hashed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    49
  uintx  _known;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    50
  uintx  _new;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    51
  uintx  _new_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    52
  uintx  _deduped;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    53
  uintx  _deduped_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    54
  uintx  _deduped_young;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    55
  uintx  _deduped_young_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    56
  uintx  _deduped_old;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    57
  uintx  _deduped_old_bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    58
  uintx  _idle;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    59
  uintx  _exec;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    60
  uintx  _block;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    61
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    62
  // Time spent by the deduplication thread in different phases
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    63
  double _start;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    64
  double _idle_elapsed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    65
  double _exec_elapsed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    66
  double _block_elapsed;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    67
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    68
public:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    69
  G1StringDedupStat();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    70
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    71
  void inc_inspected() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    72
    _inspected++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    73
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    74
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    75
  void inc_skipped() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    76
    _skipped++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    77
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    78
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    79
  void inc_hashed() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    80
    _hashed++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    81
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    82
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    83
  void inc_known() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    84
    _known++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    85
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    86
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    87
  void inc_new(uintx bytes) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    88
    _new++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    89
    _new_bytes += bytes;
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_deduped_young(uintx bytes) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    93
    _deduped++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    94
    _deduped_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    95
    _deduped_young++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    96
    _deduped_young_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    97
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    98
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    99
  void inc_deduped_old(uintx bytes) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   100
    _deduped++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   101
    _deduped_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   102
    _deduped_old++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   103
    _deduped_old_bytes += bytes;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   104
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   105
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   106
  void mark_idle() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   107
    _start = os::elapsedTime();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   108
    _idle++;
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_exec() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   112
    double now = os::elapsedTime();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   113
    _idle_elapsed = now - _start;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   114
    _start = now;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   115
    _exec++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   116
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   117
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   118
  void mark_block() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   119
    double now = os::elapsedTime();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   120
    _exec_elapsed += now - _start;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   121
    _start = now;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   122
    _block++;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   123
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   124
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   125
  void mark_unblock() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   126
    double now = os::elapsedTime();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   127
    _block_elapsed += now - _start;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   128
    _start = now;
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_done() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   132
    double now = os::elapsedTime();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   133
    _exec_elapsed += now - _start;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   134
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   135
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   136
  void add(const G1StringDedupStat& stat);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   137
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30764
diff changeset
   138
  static void print_summary(const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat);
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30764
diff changeset
   139
  static void print_statistics(const G1StringDedupStat& stat, bool total);
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   140
};
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   141
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 23472
diff changeset
   142
#endif // SHARE_VM_GC_G1_G1STRINGDEDUPSTAT_HPP