src/share/vm/gc_implementation/g1/g1StringDedupStat.hpp

Tue, 18 Mar 2014 19:07:22 +0100

author
pliden
date
Tue, 18 Mar 2014 19:07:22 +0100
changeset 6413
595c0f60d50d
parent 0
f90c822e73f8
permissions
-rw-r--r--

8029075: String deduplication in G1
Summary: Implementation of JEP 192, http://openjdk.java.net/jeps/192
Reviewed-by: brutisso, tschatzl, coleenp

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPSTAT_HPP
aoqi@0 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPSTAT_HPP
aoqi@0 27
aoqi@0 28 #include "memory/allocation.hpp"
aoqi@0 29 #include "runtime/os.hpp"
aoqi@0 30
aoqi@0 31 // Macros for GC log output formating
aoqi@0 32 #define G1_STRDEDUP_OBJECTS_FORMAT UINTX_FORMAT_W(12)
aoqi@0 33 #define G1_STRDEDUP_TIME_FORMAT "%1.7lf secs"
aoqi@0 34 #define G1_STRDEDUP_PERCENT_FORMAT "%5.1lf%%"
aoqi@0 35 #define G1_STRDEDUP_PERCENT_FORMAT_NS "%.1lf%%"
aoqi@0 36 #define G1_STRDEDUP_BYTES_FORMAT "%8.1lf%s"
aoqi@0 37 #define G1_STRDEDUP_BYTES_FORMAT_NS "%.1lf%s"
aoqi@0 38 #define G1_STRDEDUP_BYTES_PARAM(bytes) byte_size_in_proper_unit((double)(bytes)), proper_unit_for_byte_size((bytes))
aoqi@0 39
aoqi@0 40 //
aoqi@0 41 // Statistics gathered by the deduplication thread.
aoqi@0 42 //
aoqi@0 43 class G1StringDedupStat : public StackObj {
aoqi@0 44 private:
aoqi@0 45 // Counters
aoqi@0 46 uintx _inspected;
aoqi@0 47 uintx _skipped;
aoqi@0 48 uintx _hashed;
aoqi@0 49 uintx _known;
aoqi@0 50 uintx _new;
aoqi@0 51 uintx _new_bytes;
aoqi@0 52 uintx _deduped;
aoqi@0 53 uintx _deduped_bytes;
aoqi@0 54 uintx _deduped_young;
aoqi@0 55 uintx _deduped_young_bytes;
aoqi@0 56 uintx _deduped_old;
aoqi@0 57 uintx _deduped_old_bytes;
aoqi@0 58 uintx _idle;
aoqi@0 59 uintx _exec;
aoqi@0 60 uintx _block;
aoqi@0 61
aoqi@0 62 // Time spent by the deduplication thread in different phases
aoqi@0 63 double _start;
aoqi@0 64 double _idle_elapsed;
aoqi@0 65 double _exec_elapsed;
aoqi@0 66 double _block_elapsed;
aoqi@0 67
aoqi@0 68 public:
aoqi@0 69 G1StringDedupStat();
aoqi@0 70
aoqi@0 71 void inc_inspected() {
aoqi@0 72 _inspected++;
aoqi@0 73 }
aoqi@0 74
aoqi@0 75 void inc_skipped() {
aoqi@0 76 _skipped++;
aoqi@0 77 }
aoqi@0 78
aoqi@0 79 void inc_hashed() {
aoqi@0 80 _hashed++;
aoqi@0 81 }
aoqi@0 82
aoqi@0 83 void inc_known() {
aoqi@0 84 _known++;
aoqi@0 85 }
aoqi@0 86
aoqi@0 87 void inc_new(uintx bytes) {
aoqi@0 88 _new++;
aoqi@0 89 _new_bytes += bytes;
aoqi@0 90 }
aoqi@0 91
aoqi@0 92 void inc_deduped_young(uintx bytes) {
aoqi@0 93 _deduped++;
aoqi@0 94 _deduped_bytes += bytes;
aoqi@0 95 _deduped_young++;
aoqi@0 96 _deduped_young_bytes += bytes;
aoqi@0 97 }
aoqi@0 98
aoqi@0 99 void inc_deduped_old(uintx bytes) {
aoqi@0 100 _deduped++;
aoqi@0 101 _deduped_bytes += bytes;
aoqi@0 102 _deduped_old++;
aoqi@0 103 _deduped_old_bytes += bytes;
aoqi@0 104 }
aoqi@0 105
aoqi@0 106 void mark_idle() {
aoqi@0 107 _start = os::elapsedTime();
aoqi@0 108 _idle++;
aoqi@0 109 }
aoqi@0 110
aoqi@0 111 void mark_exec() {
aoqi@0 112 double now = os::elapsedTime();
aoqi@0 113 _idle_elapsed = now - _start;
aoqi@0 114 _start = now;
aoqi@0 115 _exec++;
aoqi@0 116 }
aoqi@0 117
aoqi@0 118 void mark_block() {
aoqi@0 119 double now = os::elapsedTime();
aoqi@0 120 _exec_elapsed += now - _start;
aoqi@0 121 _start = now;
aoqi@0 122 _block++;
aoqi@0 123 }
aoqi@0 124
aoqi@0 125 void mark_unblock() {
aoqi@0 126 double now = os::elapsedTime();
aoqi@0 127 _block_elapsed += now - _start;
aoqi@0 128 _start = now;
aoqi@0 129 }
aoqi@0 130
aoqi@0 131 void mark_done() {
aoqi@0 132 double now = os::elapsedTime();
aoqi@0 133 _exec_elapsed += now - _start;
aoqi@0 134 }
aoqi@0 135
aoqi@0 136 void add(const G1StringDedupStat& stat);
aoqi@0 137
aoqi@0 138 static void print_summary(outputStream* st, const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat);
aoqi@0 139 static void print_statistics(outputStream* st, const G1StringDedupStat& stat, bool total);
aoqi@0 140 };
aoqi@0 141
aoqi@0 142 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPSTAT_HPP

mercurial