annotate src/share/vm/gc_implementation/g1/g1StringDedupStat.hpp @ 17764:595c0f60d50d

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