author | coleenp |
Thu, 10 Jan 2019 15:13:51 -0500 | |
changeset 53244 | 9807daeb47c4 |
parent 50574 | fa727a4d7934 |
permissions | -rw-r--r-- |
50574 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
2 |
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. |
50574 | 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 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_STRINGDEDUP_STRINGDEDUPSTAT_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
26 |
#define SHARE_GC_SHARED_STRINGDEDUP_STRINGDEDUPSTAT_HPP |
50574 | 27 |
|
28 |
#include "memory/allocation.hpp" |
|
29 |
#include "runtime/os.hpp" |
|
30 |
||
31 |
// Macros for GC log output formating |
|
32 |
#define STRDEDUP_OBJECTS_FORMAT UINTX_FORMAT_W(12) |
|
33 |
#define STRDEDUP_TIME_FORMAT "%.3fs" |
|
34 |
#define STRDEDUP_TIME_PARAM(time) (time) |
|
35 |
#define STRDEDUP_TIME_FORMAT_MS "%.3fms" |
|
36 |
#define STRDEDUP_TIME_PARAM_MS(time) ((time) * MILLIUNITS) |
|
37 |
#define STRDEDUP_PERCENT_FORMAT "%5.1f%%" |
|
38 |
#define STRDEDUP_PERCENT_FORMAT_NS "%.1f%%" |
|
39 |
#define STRDEDUP_BYTES_FORMAT "%8.1f%s" |
|
40 |
#define STRDEDUP_BYTES_FORMAT_NS "%.1f%s" |
|
41 |
#define STRDEDUP_BYTES_PARAM(bytes) byte_size_in_proper_unit((double)(bytes)), proper_unit_for_byte_size((bytes)) |
|
42 |
||
43 |
// |
|
44 |
// Statistics gathered by the deduplication thread. |
|
45 |
// |
|
46 |
class StringDedupStat : public CHeapObj<mtGC> { |
|
47 |
protected: |
|
48 |
// Counters |
|
49 |
uintx _inspected; |
|
50 |
uintx _skipped; |
|
51 |
uintx _hashed; |
|
52 |
uintx _known; |
|
53 |
uintx _new; |
|
54 |
uintx _new_bytes; |
|
55 |
uintx _deduped; |
|
56 |
uintx _deduped_bytes; |
|
57 |
uintx _idle; |
|
58 |
uintx _exec; |
|
59 |
uintx _block; |
|
60 |
||
61 |
// Time spent by the deduplication thread in different phases |
|
62 |
double _start_concurrent; |
|
63 |
double _end_concurrent; |
|
64 |
double _start_phase; |
|
65 |
double _idle_elapsed; |
|
66 |
double _exec_elapsed; |
|
67 |
double _block_elapsed; |
|
68 |
||
69 |
public: |
|
70 |
StringDedupStat(); |
|
71 |
||
72 |
void inc_inspected() { |
|
73 |
_inspected++; |
|
74 |
} |
|
75 |
||
76 |
void inc_skipped() { |
|
77 |
_skipped++; |
|
78 |
} |
|
79 |
||
80 |
void inc_hashed() { |
|
81 |
_hashed++; |
|
82 |
} |
|
83 |
||
84 |
void inc_known() { |
|
85 |
_known++; |
|
86 |
} |
|
87 |
||
88 |
void inc_new(uintx bytes) { |
|
89 |
_new++; |
|
90 |
_new_bytes += bytes; |
|
91 |
} |
|
92 |
||
93 |
virtual void deduped(oop obj, uintx bytes) { |
|
94 |
_deduped++; |
|
95 |
_deduped_bytes += bytes; |
|
96 |
} |
|
97 |
||
98 |
void mark_idle() { |
|
99 |
_start_phase = os::elapsedTime(); |
|
100 |
_idle++; |
|
101 |
} |
|
102 |
||
103 |
void mark_exec() { |
|
104 |
double now = os::elapsedTime(); |
|
105 |
_idle_elapsed = now - _start_phase; |
|
106 |
_start_phase = now; |
|
107 |
_start_concurrent = now; |
|
108 |
_exec++; |
|
109 |
} |
|
110 |
||
111 |
void mark_block() { |
|
112 |
double now = os::elapsedTime(); |
|
113 |
_exec_elapsed += now - _start_phase; |
|
114 |
_start_phase = now; |
|
115 |
_block++; |
|
116 |
} |
|
117 |
||
118 |
void mark_unblock() { |
|
119 |
double now = os::elapsedTime(); |
|
120 |
_block_elapsed += now - _start_phase; |
|
121 |
_start_phase = now; |
|
122 |
} |
|
123 |
||
124 |
void mark_done() { |
|
125 |
double now = os::elapsedTime(); |
|
126 |
_exec_elapsed += now - _start_phase; |
|
127 |
_end_concurrent = now; |
|
128 |
} |
|
129 |
||
130 |
virtual void reset(); |
|
131 |
virtual void add(const StringDedupStat* const stat); |
|
132 |
virtual void print_statistics(bool total) const; |
|
133 |
||
134 |
static void print_start(const StringDedupStat* last_stat); |
|
135 |
static void print_end(const StringDedupStat* last_stat, const StringDedupStat* total_stat); |
|
136 |
}; |
|
137 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
138 |
#endif // SHARE_GC_SHARED_STRINGDEDUP_STRINGDEDUPSTAT_HPP |