Mercurial > hg > graal-compiler
annotate src/share/vm/services/runtimeService.cpp @ 14752:311bf6c7488b
revert some changes to match upstream files
author | twisti |
---|---|
date | Tue, 25 Mar 2014 16:25:02 -0700 |
parents | e6195383bcaf |
children | 4ca6dc0799b6 |
rev | line source |
---|---|
0 | 1 /* |
12852
0db3ba3f6870
8026041: JVM crashes with assert "assert(is_updated()) failed: must not be clear" with -XX:+PrintGCApplicationConcurrentTime in -Xcomp mode
hseigel
parents:
10103
diff
changeset
|
2 * Copyright (c) 2003, 2013, 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 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
34 #if INCLUDE_MANAGEMENT |
0 | 35 TimeStamp RuntimeService::_app_timer; |
36 TimeStamp RuntimeService::_safepoint_timer; | |
37 PerfCounter* RuntimeService::_sync_time_ticks = NULL; | |
38 PerfCounter* RuntimeService::_total_safepoints = NULL; | |
39 PerfCounter* RuntimeService::_safepoint_time_ticks = NULL; | |
40 PerfCounter* RuntimeService::_application_time_ticks = NULL; | |
41 PerfCounter* RuntimeService::_thread_interrupt_signaled_count = NULL; | |
42 PerfCounter* RuntimeService::_interrupted_before_count = NULL; | |
43 PerfCounter* RuntimeService::_interrupted_during_count = NULL; | |
44 | |
45 void RuntimeService::init() { | |
46 // Make sure the VM version is initialized | |
47 Abstract_VM_Version::initialize(); | |
48 | |
49 if (UsePerfData) { | |
50 EXCEPTION_MARK; | |
51 | |
52 _sync_time_ticks = | |
53 PerfDataManager::create_counter(SUN_RT, "safepointSyncTime", | |
54 PerfData::U_Ticks, CHECK); | |
55 | |
56 _total_safepoints = | |
57 PerfDataManager::create_counter(SUN_RT, "safepoints", | |
58 PerfData::U_Events, CHECK); | |
59 | |
60 _safepoint_time_ticks = | |
61 PerfDataManager::create_counter(SUN_RT, "safepointTime", | |
62 PerfData::U_Ticks, CHECK); | |
63 | |
64 _application_time_ticks = | |
65 PerfDataManager::create_counter(SUN_RT, "applicationTime", | |
66 PerfData::U_Ticks, CHECK); | |
67 | |
68 | |
69 // create performance counters for jvm_version and its capabilities | |
70 PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None, | |
71 (jlong) Abstract_VM_Version::jvm_version(), CHECK); | |
72 | |
73 // I/O interruption related counters | |
74 | |
75 // thread signaling via os::interrupt() | |
76 | |
77 _thread_interrupt_signaled_count = | |
78 PerfDataManager::create_counter(SUN_RT, | |
79 "threadInterruptSignaled", PerfData::U_Events, CHECK); | |
80 | |
81 // OS_INTRPT via "check before" in _INTERRUPTIBLE | |
82 | |
83 _interrupted_before_count = | |
84 PerfDataManager::create_counter(SUN_RT, "interruptedBeforeIO", | |
85 PerfData::U_Events, CHECK); | |
86 | |
87 // OS_INTRPT via "check during" in _INTERRUPTIBLE | |
88 | |
89 _interrupted_during_count = | |
90 PerfDataManager::create_counter(SUN_RT, "interruptedDuringIO", | |
91 PerfData::U_Events, CHECK); | |
92 | |
93 // The capabilities counter is a binary representation of the VM capabilities in string. | |
94 // This string respresentation simplifies the implementation of the client side | |
95 // to parse the value. | |
96 char capabilities[65]; | |
97 size_t len = sizeof(capabilities); | |
98 memset((void*) capabilities, '0', len); | |
99 capabilities[len-1] = '\0'; | |
100 capabilities[0] = AttachListener::is_attach_supported() ? '1' : '0'; | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
101 #if INCLUDE_SERVICES |
0 | 102 capabilities[1] = '1'; |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
103 #endif // INCLUDE_SERVICES |
0 | 104 PerfDataManager::create_string_constant(SUN_RT, "jvmCapabilities", |
105 capabilities, CHECK); | |
106 } | |
107 } | |
108 | |
109 void RuntimeService::record_safepoint_begin() { | |
4006 | 110 HS_PRIVATE_SAFEPOINT_BEGIN(); |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
111 |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
112 // Print the time interval in which the app was executing |
12852
0db3ba3f6870
8026041: JVM crashes with assert "assert(is_updated()) failed: must not be clear" with -XX:+PrintGCApplicationConcurrentTime in -Xcomp mode
hseigel
parents:
10103
diff
changeset
|
113 if (PrintGCApplicationConcurrentTime && _app_timer.is_updated()) { |
10103
07a4efc5ed14
8012455: Missing time and date stamps for PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime
brutisso
parents:
8001
diff
changeset
|
114 gclog_or_tty->date_stamp(PrintGCDateStamps); |
07a4efc5ed14
8012455: Missing time and date stamps for PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime
brutisso
parents:
8001
diff
changeset
|
115 gclog_or_tty->stamp(PrintGCTimeStamps); |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
116 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
|
117 last_application_time_sec()); |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
118 } |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
119 |
0 | 120 // update the time stamp to begin recording safepoint time |
121 _safepoint_timer.update(); | |
122 if (UsePerfData) { | |
123 _total_safepoints->inc(); | |
124 if (_app_timer.is_updated()) { | |
125 _application_time_ticks->inc(_app_timer.ticks_since_update()); | |
126 } | |
127 } | |
128 } | |
129 | |
130 void RuntimeService::record_safepoint_synchronized() { | |
131 if (UsePerfData) { | |
132 _sync_time_ticks->inc(_safepoint_timer.ticks_since_update()); | |
133 } | |
134 } | |
135 | |
136 void RuntimeService::record_safepoint_end() { | |
4006 | 137 HS_PRIVATE_SAFEPOINT_END(); |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
138 |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
139 // 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
|
140 // during the current safepoint operation. |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
141 if (PrintGCApplicationStoppedTime) { |
10103
07a4efc5ed14
8012455: Missing time and date stamps for PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime
brutisso
parents:
8001
diff
changeset
|
142 gclog_or_tty->date_stamp(PrintGCDateStamps); |
07a4efc5ed14
8012455: Missing time and date stamps for PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime
brutisso
parents:
8001
diff
changeset
|
143 gclog_or_tty->stamp(PrintGCTimeStamps); |
1260
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
144 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
|
145 "were stopped: %3.7f seconds", |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
146 last_safepoint_time_sec()); |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
147 } |
8859772195c6
6782663: Data produced by PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime is not accurate.
johnc
parents:
0
diff
changeset
|
148 |
0 | 149 // update the time stamp to begin recording app time |
150 _app_timer.update(); | |
151 if (UsePerfData) { | |
152 _safepoint_time_ticks->inc(_safepoint_timer.ticks_since_update()); | |
153 } | |
154 } | |
155 | |
156 void RuntimeService::record_application_start() { | |
157 // update the time stamp to begin recording app time | |
158 _app_timer.update(); | |
159 } | |
160 | |
161 // Don't need to record application end because we currently | |
162 // exit at a safepoint and record_safepoint_begin() handles updating | |
163 // the application time counter at VM exit. | |
164 | |
165 jlong RuntimeService::safepoint_sync_time_ms() { | |
166 return UsePerfData ? | |
167 Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1; | |
168 } | |
169 | |
170 jlong RuntimeService::safepoint_count() { | |
171 return UsePerfData ? | |
172 _total_safepoints->get_value() : -1; | |
173 } | |
174 jlong RuntimeService::safepoint_time_ms() { | |
175 return UsePerfData ? | |
176 Management::ticks_to_ms(_safepoint_time_ticks->get_value()) : -1; | |
177 } | |
178 | |
179 jlong RuntimeService::application_time_ms() { | |
180 return UsePerfData ? | |
181 Management::ticks_to_ms(_application_time_ticks->get_value()) : -1; | |
182 } | |
183 | |
184 void RuntimeService::record_interrupted_before_count() { | |
185 if (UsePerfData) { | |
186 _interrupted_before_count->inc(); | |
187 } | |
188 } | |
189 | |
190 void RuntimeService::record_interrupted_during_count() { | |
191 if (UsePerfData) { | |
192 _interrupted_during_count->inc(); | |
193 } | |
194 } | |
195 | |
196 void RuntimeService::record_thread_interrupt_signaled_count() { | |
197 if (UsePerfData) { | |
198 _thread_interrupt_signaled_count->inc(); | |
199 } | |
200 } | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
201 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
4006
diff
changeset
|
202 #endif // INCLUDE_MANAGEMENT |