author | tschatzl |
Wed, 17 Jul 2019 16:33:19 +0200 | |
changeset 55722 | 5ee183a90e65 |
parent 50574 | fa727a4d7934 |
permissions | -rw-r--r-- |
23472 | 1 |
/* |
50574 | 2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
23472 | 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 |
#include "precompiled.hpp" |
|
50574 | 26 |
|
27 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
|
30764 | 28 |
#include "gc/g1/g1StringDedupStat.hpp" |
35061 | 29 |
#include "logging/log.hpp" |
23472 | 30 |
|
50574 | 31 |
G1StringDedupStat::G1StringDedupStat() : StringDedupStat(), |
23472 | 32 |
_deduped_young(0), |
33 |
_deduped_young_bytes(0), |
|
34 |
_deduped_old(0), |
|
35 |
_deduped_old_bytes(0), |
|
50574 | 36 |
_heap(G1CollectedHeap::heap()) { |
23472 | 37 |
} |
38 |
||
50574 | 39 |
|
23472 | 40 |
|
50574 | 41 |
void G1StringDedupStat::deduped(oop obj, uintx bytes) { |
42 |
StringDedupStat::deduped(obj, bytes); |
|
43 |
if (_heap->is_in_young(obj)) { |
|
44 |
_deduped_young ++; |
|
45 |
_deduped_young_bytes += bytes; |
|
46 |
} else { |
|
47 |
_deduped_old ++; |
|
48 |
_deduped_old_bytes += bytes; |
|
49 |
} |
|
39690
09a3ee292336
8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents:
39287
diff
changeset
|
50 |
} |
09a3ee292336
8159974: G1 String deduplication logging not aligned with the rest of G1
pliden
parents:
39287
diff
changeset
|
51 |
|
50574 | 52 |
void G1StringDedupStat::add(const StringDedupStat* const stat) { |
53 |
StringDedupStat::add(stat); |
|
54 |
const G1StringDedupStat* const g1_stat = (const G1StringDedupStat* const)stat; |
|
55 |
_deduped_young += g1_stat->_deduped_young; |
|
56 |
_deduped_young_bytes += g1_stat->_deduped_young_bytes; |
|
57 |
_deduped_old += g1_stat->_deduped_old; |
|
58 |
_deduped_old_bytes += g1_stat->_deduped_old_bytes; |
|
23472 | 59 |
} |
60 |
||
50574 | 61 |
void G1StringDedupStat::print_statistics(bool total) const { |
62 |
StringDedupStat::print_statistics(total); |
|
63 |
||
64 |
double deduped_young_percent = percent_of(_deduped_young, _deduped); |
|
65 |
double deduped_young_bytes_percent = percent_of(_deduped_young_bytes, _deduped_bytes); |
|
66 |
double deduped_old_percent = percent_of(_deduped_old, _deduped); |
|
67 |
double deduped_old_bytes_percent = percent_of(_deduped_old_bytes, _deduped_bytes); |
|
23472 | 68 |
|
50574 | 69 |
log_debug(gc, stringdedup)(" Young: " STRDEDUP_OBJECTS_FORMAT "(" STRDEDUP_PERCENT_FORMAT ") " STRDEDUP_BYTES_FORMAT "(" STRDEDUP_PERCENT_FORMAT ")", |
70 |
_deduped_young, deduped_young_percent, STRDEDUP_BYTES_PARAM(_deduped_young_bytes), deduped_young_bytes_percent); |
|
71 |
log_debug(gc, stringdedup)(" Old: " STRDEDUP_OBJECTS_FORMAT "(" STRDEDUP_PERCENT_FORMAT ") " STRDEDUP_BYTES_FORMAT "(" STRDEDUP_PERCENT_FORMAT ")", |
|
72 |
_deduped_old, deduped_old_percent, STRDEDUP_BYTES_PARAM(_deduped_old_bytes), deduped_old_bytes_percent); |
|
73 |
||
23472 | 74 |
} |
50574 | 75 |
|
76 |
void G1StringDedupStat::reset() { |
|
77 |
StringDedupStat::reset(); |
|
78 |
_deduped_young = 0; |
|
79 |
_deduped_young_bytes = 0; |
|
80 |
_deduped_old = 0; |
|
81 |
_deduped_old_bytes = 0; |
|
82 |
} |