Mercurial > hg > truffle
annotate src/share/vm/services/runtimeService.cpp @ 9586:c064c48b9387
fix virtualization of ObjectEqualsNode
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 06 May 2013 16:58:23 +0200 |
parents | db9981fd3124 |
children | 07a4efc5ed14 |
rev | line source |
---|---|
0 | 1 /* |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1260
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1260
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1260
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/classLoader.hpp" | |
27 #include "services/attachListener.hpp" | |
28 #include "services/management.hpp" | |
29 #include "services/runtimeService.hpp" | |
30 #include "utilities/dtrace.hpp" | |
31 #include "utilities/exceptions.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6854
diff
changeset
|
32 #include "utilities/macros.hpp" |
0 | 33 |
4006 | 34 #ifndef USDT2 |
0 | 35 HS_DTRACE_PROBE_DECL(hs_private, safepoint__begin); |
36 HS_DTRACE_PROBE_DECL(hs_private, safepoint__end); | |
4006 | 37 #endif /* !USDT2 */ |
0 | 38 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
39 #if INCLUDE_MANAGEMENT |
0 | 40 TimeStamp RuntimeService::_app_timer; |
41 TimeStamp RuntimeService::_safepoint_timer; | |
42 PerfCounter* RuntimeService::_sync_time_ticks = NULL; | |
43 PerfCounter* RuntimeService::_total_safepoints = NULL; | |
44 PerfCounter* RuntimeService::_safepoint_time_ticks = NULL; | |
45 PerfCounter* RuntimeService::_application_time_ticks = NULL; | |
46 PerfCounter* RuntimeService::_thread_interrupt_signaled_count = NULL; | |
47 PerfCounter* RuntimeService::_interrupted_before_count = NULL; | |
48 PerfCounter* RuntimeService::_interrupted_during_count = NULL; | |
49 | |
50 void RuntimeService::init() { | |
51 // Make sure the VM version is initialized | |
52 Abstract_VM_Version::initialize(); | |
53 | |
54 if (UsePerfData) { | |
55 EXCEPTION_MARK; | |
56 | |
57 _sync_time_ticks = | |
58 PerfDataManager::create_counter(SUN_RT, "safepointSyncTime", | |
59 PerfData::U_Ticks, CHECK); | |
60 | |
61 _total_safepoints = | |
62 PerfDataManager::create_counter(SUN_RT, "safepoints", | |
63 PerfData::U_Events, CHECK); | |
64 | |
65 _safepoint_time_ticks = | |
66 PerfDataManager::create_counter(SUN_RT, "safepointTime", | |
67 PerfData::U_Ticks, CHECK); | |
68 | |
69 _application_time_ticks = | |
70 PerfDataManager::create_counter(SUN_RT, "applicationTime", | |
71 PerfData::U_Ticks, CHECK); | |
72 | |
73 | |
74 // create performance counters for jvm_version and its capabilities | |
75 PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None, | |
76 (jlong) Abstract_VM_Version::jvm_version(), CHECK); | |
77 | |
78 // I/O interruption related counters | |
79 | |
80 // thread signaling via os::interrupt() | |
81 | |
82 _thread_interrupt_signaled_count = | |
83 PerfDataManager::create_counter(SUN_RT, | |
84 "threadInterruptSignaled", PerfData::U_Events, CHECK); | |
85 | |
86 // OS_INTRPT via "check before" in _INTERRUPTIBLE | |
87 | |
88 _interrupted_before_count = | |
89 PerfDataManager::create_counter(SUN_RT, "interruptedBeforeIO", | |
90 PerfData::U_Events, CHECK); | |
91 | |
92 // OS_INTRPT via "check during" in _INTERRUPTIBLE | |
93 | |
94 _interrupted_during_count = | |
95 PerfDataManager::create_counter(SUN_RT, "interruptedDuringIO", | |
96 PerfData::U_Events, CHECK); | |
97 | |
98 // The capabilities counter is a binary representation of the VM capabilities in string. | |
99 // This string respresentation simplifies the implementation of the client side | |
100 // to parse the value. | |
101 char capabilities[65]; | |
102 size_t len = sizeof(capabilities); | |
103 memset((void*) capabilities, '0', len); | |
104 capabilities[len-1] = '\0'; | |
105 capabilities[0] = AttachListener::is_attach_supported() ? '1' : '0'; | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
106 #if INCLUDE_SERVICES |
0 | 107 capabilities[1] = '1'; |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
108 #endif // INCLUDE_SERVICES |
0 | 109 PerfDataManager::create_string_constant(SUN_RT, "jvmCapabilities", |
110 capabilities, CHECK); | |
111 } | |
112 } | |
113 | |
114 void RuntimeService::record_safepoint_begin() { | |
4006 | 115 #ifndef USDT2 |
0 | 116 HS_DTRACE_PROBE(hs_private, safepoint__begin); |
4006 | 117 #else /* USDT2 */ |
118 HS_PRIVATE_SAFEPOINT_BEGIN(); | |
119 #endif /* USDT2 */ | |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
120 |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
121 // Print the time interval in which the app was executing |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
122 if (PrintGCApplicationConcurrentTime) { |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
123 gclog_or_tty->print_cr("Application time: %3.7f seconds", |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
124 last_application_time_sec()); |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
125 } |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
126 |
0 | 127 // update the time stamp to begin recording safepoint time |
128 _safepoint_timer.update(); | |
129 if (UsePerfData) { | |
130 _total_safepoints->inc(); | |
131 if (_app_timer.is_updated()) { | |
132 _application_time_ticks->inc(_app_timer.ticks_since_update()); | |
133 } | |
134 } | |
135 } | |
136 | |
137 void RuntimeService::record_safepoint_synchronized() { | |
138 if (UsePerfData) { | |
139 _sync_time_ticks->inc(_safepoint_timer.ticks_since_update()); | |
140 } | |
141 } | |
142 | |
143 void RuntimeService::record_safepoint_end() { | |
4006 | 144 #ifndef USDT2 |
0 | 145 HS_DTRACE_PROBE(hs_private, safepoint__end); |
4006 | 146 #else /* USDT2 */ |
147 HS_PRIVATE_SAFEPOINT_END(); | |
148 #endif /* USDT2 */ | |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
149 |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
150 // Print the time interval for which the app was stopped |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
151 // during the current safepoint operation. |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
152 if (PrintGCApplicationStoppedTime) { |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
153 gclog_or_tty->print_cr("Total time for which application threads " |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
154 "were stopped: %3.7f seconds", |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
155 last_safepoint_time_sec()); |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
156 } |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
157 |
0 | 158 // update the time stamp to begin recording app time |
159 _app_timer.update(); | |
160 if (UsePerfData) { | |
161 _safepoint_time_ticks->inc(_safepoint_timer.ticks_since_update()); | |
162 } | |
163 } | |
164 | |
165 void RuntimeService::record_application_start() { | |
166 // update the time stamp to begin recording app time | |
167 _app_timer.update(); | |
168 } | |
169 | |
170 // Don't need to record application end because we currently | |
171 // exit at a safepoint and record_safepoint_begin() handles updating | |
172 // the application time counter at VM exit. | |
173 | |
174 jlong RuntimeService::safepoint_sync_time_ms() { | |
175 return UsePerfData ? | |
176 Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1; | |
177 } | |
178 | |
179 jlong RuntimeService::safepoint_count() { | |
180 return UsePerfData ? | |
181 _total_safepoints->get_value() : -1; | |
182 } | |
183 jlong RuntimeService::safepoint_time_ms() { | |
184 return UsePerfData ? | |
185 Management::ticks_to_ms(_safepoint_time_ticks->get_value()) : -1; | |
186 } | |
187 | |
188 jlong RuntimeService::application_time_ms() { | |
189 return UsePerfData ? | |
190 Management::ticks_to_ms(_application_time_ticks->get_value()) : -1; | |
191 } | |
192 | |
193 void RuntimeService::record_interrupted_before_count() { | |
194 if (UsePerfData) { | |
195 _interrupted_before_count->inc(); | |
196 } | |
197 } | |
198 | |
199 void RuntimeService::record_interrupted_during_count() { | |
200 if (UsePerfData) { | |
201 _interrupted_during_count->inc(); | |
202 } | |
203 } | |
204 | |
205 void RuntimeService::record_thread_interrupt_signaled_count() { | |
206 if (UsePerfData) { | |
207 _thread_interrupt_signaled_count->inc(); | |
208 } | |
209 } | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
210 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
211 #endif // INCLUDE_MANAGEMENT |