Mercurial > hg > graal-compiler
annotate src/share/vm/services/runtimeService.cpp @ 2142:8012aa3ccede
4926272: methodOopDesc::method_from_bcp is unsafe
Reviewed-by: coleenp, jrose, kvn, dcubed
author | never |
---|---|
date | Thu, 13 Jan 2011 22:15:41 -0800 |
parents | f95d63e2154a |
children | 436b4a3231bf |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1260
diff
changeset
|
2 * Copyright (c) 2003, 2010, 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" | |
0 | 32 |
33 HS_DTRACE_PROBE_DECL(hs_private, safepoint__begin); | |
34 HS_DTRACE_PROBE_DECL(hs_private, safepoint__end); | |
35 | |
36 TimeStamp RuntimeService::_app_timer; | |
37 TimeStamp RuntimeService::_safepoint_timer; | |
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 PerfCounter* RuntimeService::_thread_interrupt_signaled_count = NULL; | |
43 PerfCounter* RuntimeService::_interrupted_before_count = NULL; | |
44 PerfCounter* RuntimeService::_interrupted_during_count = NULL; | |
45 | |
46 void RuntimeService::init() { | |
47 // Make sure the VM version is initialized | |
48 Abstract_VM_Version::initialize(); | |
49 | |
50 if (UsePerfData) { | |
51 EXCEPTION_MARK; | |
52 | |
53 _sync_time_ticks = | |
54 PerfDataManager::create_counter(SUN_RT, "safepointSyncTime", | |
55 PerfData::U_Ticks, CHECK); | |
56 | |
57 _total_safepoints = | |
58 PerfDataManager::create_counter(SUN_RT, "safepoints", | |
59 PerfData::U_Events, CHECK); | |
60 | |
61 _safepoint_time_ticks = | |
62 PerfDataManager::create_counter(SUN_RT, "safepointTime", | |
63 PerfData::U_Ticks, CHECK); | |
64 | |
65 _application_time_ticks = | |
66 PerfDataManager::create_counter(SUN_RT, "applicationTime", | |
67 PerfData::U_Ticks, CHECK); | |
68 | |
69 | |
70 // create performance counters for jvm_version and its capabilities | |
71 PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None, | |
72 (jlong) Abstract_VM_Version::jvm_version(), CHECK); | |
73 | |
74 // I/O interruption related counters | |
75 | |
76 // thread signaling via os::interrupt() | |
77 | |
78 _thread_interrupt_signaled_count = | |
79 PerfDataManager::create_counter(SUN_RT, | |
80 "threadInterruptSignaled", PerfData::U_Events, CHECK); | |
81 | |
82 // OS_INTRPT via "check before" in _INTERRUPTIBLE | |
83 | |
84 _interrupted_before_count = | |
85 PerfDataManager::create_counter(SUN_RT, "interruptedBeforeIO", | |
86 PerfData::U_Events, CHECK); | |
87 | |
88 // OS_INTRPT via "check during" in _INTERRUPTIBLE | |
89 | |
90 _interrupted_during_count = | |
91 PerfDataManager::create_counter(SUN_RT, "interruptedDuringIO", | |
92 PerfData::U_Events, CHECK); | |
93 | |
94 // The capabilities counter is a binary representation of the VM capabilities in string. | |
95 // This string respresentation simplifies the implementation of the client side | |
96 // to parse the value. | |
97 char capabilities[65]; | |
98 size_t len = sizeof(capabilities); | |
99 memset((void*) capabilities, '0', len); | |
100 capabilities[len-1] = '\0'; | |
101 capabilities[0] = AttachListener::is_attach_supported() ? '1' : '0'; | |
102 #ifdef KERNEL | |
103 capabilities[1] = '1'; | |
104 #endif // KERNEL | |
105 PerfDataManager::create_string_constant(SUN_RT, "jvmCapabilities", | |
106 capabilities, CHECK); | |
107 } | |
108 } | |
109 | |
110 void RuntimeService::record_safepoint_begin() { | |
111 HS_DTRACE_PROBE(hs_private, safepoint__begin); | |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
112 |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
113 // 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
|
114 if (PrintGCApplicationConcurrentTime) { |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
115 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
|
116 last_application_time_sec()); |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
117 } |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
118 |
0 | 119 // update the time stamp to begin recording safepoint time |
120 _safepoint_timer.update(); | |
121 if (UsePerfData) { | |
122 _total_safepoints->inc(); | |
123 if (_app_timer.is_updated()) { | |
124 _application_time_ticks->inc(_app_timer.ticks_since_update()); | |
125 } | |
126 } | |
127 } | |
128 | |
129 void RuntimeService::record_safepoint_synchronized() { | |
130 if (UsePerfData) { | |
131 _sync_time_ticks->inc(_safepoint_timer.ticks_since_update()); | |
132 } | |
133 } | |
134 | |
135 void RuntimeService::record_safepoint_end() { | |
136 HS_DTRACE_PROBE(hs_private, safepoint__end); | |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
137 |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
138 // 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
|
139 // during the current safepoint operation. |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
140 if (PrintGCApplicationStoppedTime) { |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
141 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
|
142 "were stopped: %3.7f seconds", |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
143 last_safepoint_time_sec()); |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
144 } |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
145 |
0 | 146 // update the time stamp to begin recording app time |
147 _app_timer.update(); | |
148 if (UsePerfData) { | |
149 _safepoint_time_ticks->inc(_safepoint_timer.ticks_since_update()); | |
150 } | |
151 } | |
152 | |
153 void RuntimeService::record_application_start() { | |
154 // update the time stamp to begin recording app time | |
155 _app_timer.update(); | |
156 } | |
157 | |
158 // Don't need to record application end because we currently | |
159 // exit at a safepoint and record_safepoint_begin() handles updating | |
160 // the application time counter at VM exit. | |
161 | |
162 jlong RuntimeService::safepoint_sync_time_ms() { | |
163 return UsePerfData ? | |
164 Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1; | |
165 } | |
166 | |
167 jlong RuntimeService::safepoint_count() { | |
168 return UsePerfData ? | |
169 _total_safepoints->get_value() : -1; | |
170 } | |
171 jlong RuntimeService::safepoint_time_ms() { | |
172 return UsePerfData ? | |
173 Management::ticks_to_ms(_safepoint_time_ticks->get_value()) : -1; | |
174 } | |
175 | |
176 jlong RuntimeService::application_time_ms() { | |
177 return UsePerfData ? | |
178 Management::ticks_to_ms(_application_time_ticks->get_value()) : -1; | |
179 } | |
180 | |
181 void RuntimeService::record_interrupted_before_count() { | |
182 if (UsePerfData) { | |
183 _interrupted_before_count->inc(); | |
184 } | |
185 } | |
186 | |
187 void RuntimeService::record_interrupted_during_count() { | |
188 if (UsePerfData) { | |
189 _interrupted_during_count->inc(); | |
190 } | |
191 } | |
192 | |
193 void RuntimeService::record_thread_interrupt_signaled_count() { | |
194 if (UsePerfData) { | |
195 _thread_interrupt_signaled_count->inc(); | |
196 } | |
197 } |