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

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

mercurial