annotate src/share/vm/gc_implementation/g1/g1StringDedupStat.cpp @ 20211:82693fb204a5

8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet Summary: The test incorrectly assumed that it had been started with no other previous compilation activity. Fix this by allowing multiple code root free chunk lists, and use one separate from the global one to perform the test. Reviewed-by: brutisso
author tschatzl
date Wed, 16 Apr 2014 10:14:50 +0200
parents 595c0f60d50d
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 #include "precompiled.hpp"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
26 #include "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 G1StringDedupStat::G1StringDedupStat() :
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
29 _inspected(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
30 _skipped(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
31 _hashed(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
32 _known(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
33 _new(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
34 _new_bytes(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
35 _deduped(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
36 _deduped_bytes(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
37 _deduped_young(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
38 _deduped_young_bytes(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
39 _deduped_old(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
40 _deduped_old_bytes(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
41 _idle(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
42 _exec(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
43 _block(0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
44 _start(0.0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
45 _idle_elapsed(0.0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
46 _exec_elapsed(0.0),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
47 _block_elapsed(0.0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
48 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
49
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
50 void G1StringDedupStat::add(const G1StringDedupStat& stat) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
51 _inspected += stat._inspected;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
52 _skipped += stat._skipped;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
53 _hashed += stat._hashed;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
54 _known += stat._known;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
55 _new += stat._new;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
56 _new_bytes += stat._new_bytes;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
57 _deduped += stat._deduped;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
58 _deduped_bytes += stat._deduped_bytes;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
59 _deduped_young += stat._deduped_young;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
60 _deduped_young_bytes += stat._deduped_young_bytes;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
61 _deduped_old += stat._deduped_old;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
62 _deduped_old_bytes += stat._deduped_old_bytes;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
63 _idle += stat._idle;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
64 _exec += stat._exec;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
65 _block += stat._block;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
66 _idle_elapsed += stat._idle_elapsed;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
67 _exec_elapsed += stat._exec_elapsed;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
68 _block_elapsed += stat._block_elapsed;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
69 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
70
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
71 void G1StringDedupStat::print_summary(outputStream* st, const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
72 double total_deduped_bytes_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
73
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
74 if (total_stat._new_bytes > 0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
75 // Avoid division by zero
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
76 total_deduped_bytes_percent = (double)total_stat._deduped_bytes / (double)total_stat._new_bytes * 100.0;
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 st->date_stamp(PrintGCDateStamps);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
80 st->stamp(PrintGCTimeStamps);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
81 st->print_cr(
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
82 "[GC concurrent-string-deduplication, "
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
83 G1_STRDEDUP_BYTES_FORMAT_NS"->"G1_STRDEDUP_BYTES_FORMAT_NS"("G1_STRDEDUP_BYTES_FORMAT_NS"), avg "
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
84 G1_STRDEDUP_PERCENT_FORMAT_NS", "G1_STRDEDUP_TIME_FORMAT"]",
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
85 G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
86 G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes - last_stat._deduped_bytes),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
87 G1_STRDEDUP_BYTES_PARAM(last_stat._deduped_bytes),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
88 total_deduped_bytes_percent,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
89 last_stat._exec_elapsed);
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 G1StringDedupStat::print_statistics(outputStream* st, const G1StringDedupStat& stat, bool total) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
93 double young_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
94 double old_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
95 double skipped_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
96 double hashed_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
97 double known_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
98 double new_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
99 double deduped_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
100 double deduped_bytes_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
101 double deduped_young_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
102 double deduped_young_bytes_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
103 double deduped_old_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
104 double deduped_old_bytes_percent = 0.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
105
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
106 if (stat._inspected > 0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
107 // Avoid division by zero
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
108 skipped_percent = (double)stat._skipped / (double)stat._inspected * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
109 hashed_percent = (double)stat._hashed / (double)stat._inspected * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
110 known_percent = (double)stat._known / (double)stat._inspected * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
111 new_percent = (double)stat._new / (double)stat._inspected * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
112 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
113
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
114 if (stat._new > 0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
115 // Avoid division by zero
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
116 deduped_percent = (double)stat._deduped / (double)stat._new * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
117 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
118
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
119 if (stat._deduped > 0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
120 // Avoid division by zero
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
121 deduped_young_percent = (double)stat._deduped_young / (double)stat._deduped * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
122 deduped_old_percent = (double)stat._deduped_old / (double)stat._deduped * 100.0;
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 if (stat._new_bytes > 0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
126 // Avoid division by zero
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
127 deduped_bytes_percent = (double)stat._deduped_bytes / (double)stat._new_bytes * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
128 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
129
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
130 if (stat._deduped_bytes > 0) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
131 // Avoid division by zero
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
132 deduped_young_bytes_percent = (double)stat._deduped_young_bytes / (double)stat._deduped_bytes * 100.0;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
133 deduped_old_bytes_percent = (double)stat._deduped_old_bytes / (double)stat._deduped_bytes * 100.0;
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 if (total) {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
137 st->print_cr(
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
138 " [Total Exec: "UINTX_FORMAT"/"G1_STRDEDUP_TIME_FORMAT", Idle: "UINTX_FORMAT"/"G1_STRDEDUP_TIME_FORMAT", Blocked: "UINTX_FORMAT"/"G1_STRDEDUP_TIME_FORMAT"]",
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
139 stat._exec, stat._exec_elapsed, stat._idle, stat._idle_elapsed, stat._block, stat._block_elapsed);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
140 } else {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
141 st->print_cr(
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
142 " [Last Exec: "G1_STRDEDUP_TIME_FORMAT", Idle: "G1_STRDEDUP_TIME_FORMAT", Blocked: "UINTX_FORMAT"/"G1_STRDEDUP_TIME_FORMAT"]",
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
143 stat._exec_elapsed, stat._idle_elapsed, stat._block, stat._block_elapsed);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
144 }
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
145 st->print_cr(
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
146 " [Inspected: "G1_STRDEDUP_OBJECTS_FORMAT"]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
147 " [Skipped: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT")]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
148 " [Hashed: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT")]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
149 " [Known: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT")]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
150 " [New: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT") "G1_STRDEDUP_BYTES_FORMAT"]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
151 " [Deduplicated: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT") "G1_STRDEDUP_BYTES_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT")]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
152 " [Young: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT") "G1_STRDEDUP_BYTES_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT")]\n"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
153 " [Old: "G1_STRDEDUP_OBJECTS_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT") "G1_STRDEDUP_BYTES_FORMAT"("G1_STRDEDUP_PERCENT_FORMAT")]",
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
154 stat._inspected,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
155 stat._skipped, skipped_percent,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
156 stat._hashed, hashed_percent,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
157 stat._known, known_percent,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
158 stat._new, new_percent, G1_STRDEDUP_BYTES_PARAM(stat._new_bytes),
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
159 stat._deduped, deduped_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_bytes), deduped_bytes_percent,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
160 stat._deduped_young, deduped_young_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_young_bytes), deduped_young_bytes_percent,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
161 stat._deduped_old, deduped_old_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_old_bytes), deduped_old_bytes_percent);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
162 }