author | stuefe |
Tue, 26 Nov 2019 16:21:29 +0100 | |
branch | stuefe-new-metaspace-branch |
changeset 59272 | 54750b448264 |
parent 53895 | b22d8ae270a2 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53775 | 2 |
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4901
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4901
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4901
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/classLoader.hpp" |
|
35061 | 27 |
#include "logging/log.hpp" |
53895 | 28 |
#include "logging/logStream.hpp" |
29201
fee2bbb2ec1d
8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents:
27462
diff
changeset
|
29 |
#include "runtime/vm_version.hpp" |
7397 | 30 |
#include "services/attachListener.hpp" |
31 |
#include "services/management.hpp" |
|
32 |
#include "services/runtimeService.hpp" |
|
33 |
#include "utilities/dtrace.hpp" |
|
34 |
#include "utilities/exceptions.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13975
diff
changeset
|
35 |
#include "utilities/macros.hpp" |
1 | 36 |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
10739
diff
changeset
|
37 |
#if INCLUDE_MANAGEMENT |
1 | 38 |
PerfCounter* RuntimeService::_sync_time_ticks = NULL; |
39 |
PerfCounter* RuntimeService::_total_safepoints = NULL; |
|
40 |
PerfCounter* RuntimeService::_safepoint_time_ticks = NULL; |
|
41 |
PerfCounter* RuntimeService::_application_time_ticks = NULL; |
|
42 |
||
43 |
void RuntimeService::init() { |
|
44 |
if (UsePerfData) { |
|
45 |
EXCEPTION_MARK; |
|
46 |
||
47 |
_sync_time_ticks = |
|
48 |
PerfDataManager::create_counter(SUN_RT, "safepointSyncTime", |
|
49 |
PerfData::U_Ticks, CHECK); |
|
50 |
||
51 |
_total_safepoints = |
|
52 |
PerfDataManager::create_counter(SUN_RT, "safepoints", |
|
53 |
PerfData::U_Events, CHECK); |
|
54 |
||
55 |
_safepoint_time_ticks = |
|
56 |
PerfDataManager::create_counter(SUN_RT, "safepointTime", |
|
57 |
PerfData::U_Ticks, CHECK); |
|
58 |
||
59 |
_application_time_ticks = |
|
60 |
PerfDataManager::create_counter(SUN_RT, "applicationTime", |
|
61 |
PerfData::U_Ticks, CHECK); |
|
62 |
||
63 |
||
64 |
// create performance counters for jvm_version and its capabilities |
|
65 |
PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None, |
|
52148
2d9f8845d0ae
7041262: VM_Version should be called instead of Abstract_VM_Version so that overriding works
hseigel
parents:
47216
diff
changeset
|
66 |
(jlong) VM_Version::jvm_version(), CHECK); |
1 | 67 |
|
68 |
// The capabilities counter is a binary representation of the VM capabilities in string. |
|
69 |
// This string respresentation simplifies the implementation of the client side |
|
70 |
// to parse the value. |
|
71 |
char capabilities[65]; |
|
72 |
size_t len = sizeof(capabilities); |
|
73 |
memset((void*) capabilities, '0', len); |
|
74 |
capabilities[len-1] = '\0'; |
|
75 |
capabilities[0] = AttachListener::is_attach_supported() ? '1' : '0'; |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
10739
diff
changeset
|
76 |
#if INCLUDE_SERVICES |
1 | 77 |
capabilities[1] = '1'; |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
10739
diff
changeset
|
78 |
#endif // INCLUDE_SERVICES |
1 | 79 |
PerfDataManager::create_string_constant(SUN_RT, "jvmCapabilities", |
80 |
capabilities, CHECK); |
|
81 |
} |
|
82 |
} |
|
83 |
||
53895 | 84 |
void RuntimeService::record_safepoint_begin(jlong app_ticks) { |
10739 | 85 |
HS_PRIVATE_SAFEPOINT_BEGIN(); |
1 | 86 |
if (UsePerfData) { |
87 |
_total_safepoints->inc(); |
|
53895 | 88 |
_application_time_ticks->inc(app_ticks); |
27462
2fef16b8c70f
8059216: Make PrintGCApplicationStoppedTime print information about stopping threads
vkempik
parents:
23443
diff
changeset
|
89 |
} |
1 | 90 |
} |
91 |
||
53895 | 92 |
void RuntimeService::record_safepoint_synchronized(jlong sync_ticks) { |
1 | 93 |
if (UsePerfData) { |
53895 | 94 |
_sync_time_ticks->inc(sync_ticks); |
1 | 95 |
} |
96 |
} |
|
97 |
||
53895 | 98 |
void RuntimeService::record_safepoint_end(jlong safepoint_ticks) { |
99 |
HS_PRIVATE_SAFEPOINT_END(); |
|
100 |
if (UsePerfData) { |
|
101 |
_safepoint_time_ticks->inc(safepoint_ticks); |
|
53775 | 102 |
} |
103 |
} |
|
104 |
||
1 | 105 |
jlong RuntimeService::safepoint_sync_time_ms() { |
106 |
return UsePerfData ? |
|
107 |
Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1; |
|
108 |
} |
|
109 |
||
110 |
jlong RuntimeService::safepoint_count() { |
|
111 |
return UsePerfData ? |
|
112 |
_total_safepoints->get_value() : -1; |
|
113 |
} |
|
114 |
jlong RuntimeService::safepoint_time_ms() { |
|
115 |
return UsePerfData ? |
|
116 |
Management::ticks_to_ms(_safepoint_time_ticks->get_value()) : -1; |
|
117 |
} |
|
118 |
||
119 |
jlong RuntimeService::application_time_ms() { |
|
120 |
return UsePerfData ? |
|
121 |
Management::ticks_to_ms(_application_time_ticks->get_value()) : -1; |
|
122 |
} |
|
123 |
||
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
10739
diff
changeset
|
124 |
#endif // INCLUDE_MANAGEMENT |