1 | /* |
2 | * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
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" |
26 | #include "jvm.h" |
27 | #include "classfile/classLoaderDataGraph.hpp" |
28 | #include "classfile/classLoaderStats.hpp" |
29 | #include "classfile/javaClasses.hpp" |
30 | #include "classfile/stringTable.hpp" |
31 | #include "classfile/symbolTable.hpp" |
32 | #include "classfile/systemDictionary.hpp" |
33 | #include "code/codeCache.hpp" |
34 | #include "compiler/compileBroker.hpp" |
35 | #include "gc/g1/g1HeapRegionEventSender.hpp" |
36 | #include "gc/shared/gcConfiguration.hpp" |
37 | #include "gc/shared/gcTrace.hpp" |
38 | #include "gc/shared/gcVMOperations.hpp" |
39 | #include "gc/shared/objectCountEventSender.hpp" |
40 | #include "jfr/jfrEvents.hpp" |
41 | #include "jfr/periodic/jfrModuleEvent.hpp" |
42 | #include "jfr/periodic/jfrOSInterface.hpp" |
43 | #include "jfr/periodic/jfrThreadCPULoadEvent.hpp" |
44 | #include "jfr/periodic/jfrThreadDumpEvent.hpp" |
45 | #include "jfr/periodic/jfrNetworkUtilization.hpp" |
46 | #include "jfr/recorder/jfrRecorder.hpp" |
47 | #include "jfr/support/jfrThreadId.hpp" |
48 | #include "jfr/utilities/jfrTime.hpp" |
49 | #include "jfrfiles/jfrPeriodic.hpp" |
50 | #include "logging/log.hpp" |
51 | #include "memory/heapInspection.hpp" |
52 | #include "memory/resourceArea.hpp" |
53 | #include "oops/oop.inline.hpp" |
54 | #include "runtime/arguments.hpp" |
55 | #include "runtime/flags/jvmFlag.hpp" |
56 | #include "runtime/globals.hpp" |
57 | #include "runtime/os.hpp" |
58 | #include "runtime/os_perf.hpp" |
59 | #include "runtime/thread.inline.hpp" |
60 | #include "runtime/threadSMR.hpp" |
61 | #include "runtime/sweeper.hpp" |
62 | #include "runtime/vmThread.hpp" |
63 | #include "services/classLoadingService.hpp" |
64 | #include "services/management.hpp" |
65 | #include "services/threadService.hpp" |
66 | #include "utilities/exceptions.hpp" |
67 | #include "utilities/globalDefinitions.hpp" |
68 | #if INCLUDE_SHENANDOAHGC |
69 | #include "gc/shenandoah/shenandoahJfrSupport.hpp" |
70 | #endif |
71 | /** |
72 | * JfrPeriodic class |
73 | * Implementation of declarations in |
74 | * xsl generated traceRequestables.hpp |
75 | */ |
76 | #define TRACE_REQUEST_FUNC(id) void JfrPeriodicEventSet::request##id(void) |
77 | |
78 | TRACE_REQUEST_FUNC(JVMInformation) { |
79 | ResourceMark rm; |
80 | EventJVMInformation event; |
81 | event.set_jvmName(VM_Version::vm_name()); |
82 | event.set_jvmVersion(VM_Version::internal_vm_info_string()); |
83 | event.set_javaArguments(Arguments::java_command()); |
84 | event.set_jvmArguments(Arguments::jvm_args()); |
85 | event.set_jvmFlags(Arguments::jvm_flags()); |
86 | event.set_jvmStartTime(Management::vm_init_done_time()); |
87 | event.set_pid(os::current_process_id()); |
88 | event.commit(); |
89 | } |
90 | |
91 | TRACE_REQUEST_FUNC(OSInformation) { |
92 | ResourceMark rm; |
93 | char* os_name = NEW_RESOURCE_ARRAY(char, 2048); |
94 | JfrOSInterface::os_version(&os_name); |
95 | EventOSInformation event; |
96 | event.set_osVersion(os_name); |
97 | event.commit(); |
98 | } |
99 | |
100 | TRACE_REQUEST_FUNC(VirtualizationInformation) { |
101 | EventVirtualizationInformation event; |
102 | event.set_name(JfrOSInterface::virtualization_name()); |
103 | event.commit(); |
104 | } |
105 | |
106 | TRACE_REQUEST_FUNC(ModuleRequire) { |
107 | JfrModuleEvent::generate_module_dependency_events(); |
108 | } |
109 | |
110 | TRACE_REQUEST_FUNC(ModuleExport) { |
111 | JfrModuleEvent::generate_module_export_events(); |
112 | } |
113 | |
114 | /* |
115 | * This is left empty on purpose, having ExecutionSample as a requestable |
116 | * is a way of getting the period. The period is passed to ThreadSampling::update_period. |
117 | * Implementation in jfrSamples.cpp |
118 | */ |
119 | TRACE_REQUEST_FUNC(ExecutionSample) { |
120 | } |
121 | TRACE_REQUEST_FUNC(NativeMethodSample) { |
122 | } |
123 | |
124 | TRACE_REQUEST_FUNC(ThreadDump) { |
125 | ResourceMark rm; |
126 | EventThreadDump event; |
127 | event.set_result(JfrDcmdEvent::thread_dump()); |
128 | event.commit(); |
129 | } |
130 | |
131 | static int _native_library_callback(const char* name, address base, address top, void *param) { |
132 | EventNativeLibrary event(UNTIMED); |
133 | event.set_name(name); |
134 | event.set_baseAddress((u8)base); |
135 | event.set_topAddress((u8)top); |
136 | event.set_endtime(*(JfrTicks*) param); |
137 | event.commit(); |
138 | return 0; |
139 | } |
140 | |
141 | TRACE_REQUEST_FUNC(NativeLibrary) { |
142 | JfrTicks ts= JfrTicks::now(); |
143 | os::get_loaded_modules_info(&_native_library_callback, (void *)&ts); |
144 | } |
145 | |
146 | TRACE_REQUEST_FUNC(InitialEnvironmentVariable) { |
147 | JfrOSInterface::generate_initial_environment_variable_events(); |
148 | } |
149 | |
150 | TRACE_REQUEST_FUNC(CPUInformation) { |
151 | CPUInformation cpu_info; |
152 | int ret_val = JfrOSInterface::cpu_information(cpu_info); |
153 | if (ret_val == OS_ERR) { |
154 | log_debug(jfr, system)( "Unable to generate requestable event CPUInformation" ); |
155 | return; |
156 | } |
157 | if (ret_val == FUNCTIONALITY_NOT_IMPLEMENTED) { |
158 | return; |
159 | } |
160 | if (ret_val == OS_OK) { |
161 | EventCPUInformation event; |
162 | event.set_cpu(cpu_info.cpu_name()); |
163 | event.set_description(cpu_info.cpu_description()); |
164 | event.set_sockets(cpu_info.number_of_sockets()); |
165 | event.set_cores(cpu_info.number_of_cores()); |
166 | event.set_hwThreads(cpu_info.number_of_hardware_threads()); |
167 | event.commit(); |
168 | } |
169 | } |
170 | |
171 | TRACE_REQUEST_FUNC(CPULoad) { |
172 | double u = 0; // user time |
173 | double s = 0; // kernel time |
174 | double t = 0; // total time |
175 | int ret_val = JfrOSInterface::cpu_loads_process(&u, &s, &t); |
176 | if (ret_val == OS_ERR) { |
177 | log_debug(jfr, system)( "Unable to generate requestable event CPULoad" ); |
178 | return; |
179 | } |
180 | if (ret_val == OS_OK) { |
181 | EventCPULoad event; |
182 | event.set_jvmUser((float)u); |
183 | event.set_jvmSystem((float)s); |
184 | event.set_machineTotal((float)t); |
185 | event.commit(); |
186 | } |
187 | } |
188 | |
189 | TRACE_REQUEST_FUNC(ThreadCPULoad) { |
190 | JfrThreadCPULoadEvent::send_events(); |
191 | } |
192 | |
193 | TRACE_REQUEST_FUNC(NetworkUtilization) { |
194 | JfrNetworkUtilization::send_events(); |
195 | } |
196 | |
197 | TRACE_REQUEST_FUNC(CPUTimeStampCounter) { |
198 | EventCPUTimeStampCounter event; |
199 | event.set_fastTimeEnabled(JfrTime::is_ft_enabled()); |
200 | event.set_fastTimeAutoEnabled(JfrTime::is_ft_supported()); |
201 | event.set_osFrequency(os::elapsed_frequency()); |
202 | event.set_fastTimeFrequency(JfrTime::frequency()); |
203 | event.commit(); |
204 | } |
205 | |
206 | TRACE_REQUEST_FUNC(SystemProcess) { |
207 | char pid_buf[16]; |
208 | SystemProcess* processes = NULL; |
209 | int num_of_processes = 0; |
210 | JfrTicks start_time = JfrTicks::now(); |
211 | int ret_val = JfrOSInterface::system_processes(&processes, &num_of_processes); |
212 | if (ret_val == OS_ERR) { |
213 | log_debug(jfr, system)( "Unable to generate requestable event SystemProcesses" ); |
214 | return; |
215 | } |
216 | JfrTicks end_time = JfrTicks::now(); |
217 | if (ret_val == FUNCTIONALITY_NOT_IMPLEMENTED) { |
218 | return; |
219 | } |
220 | if (ret_val == OS_OK) { |
221 | // feature is implemented, write real event |
222 | while (processes != NULL) { |
223 | SystemProcess* tmp = processes; |
224 | const char* info = processes->command_line(); |
225 | if (info == NULL) { |
226 | info = processes->path(); |
227 | } |
228 | if (info == NULL) { |
229 | info = processes->name(); |
230 | } |
231 | if (info == NULL) { |
232 | info = "?" ; |
233 | } |
234 | jio_snprintf(pid_buf, sizeof(pid_buf), "%d" , processes->pid()); |
235 | EventSystemProcess event(UNTIMED); |
236 | event.set_pid(pid_buf); |
237 | event.set_commandLine(info); |
238 | event.set_starttime(start_time); |
239 | event.set_endtime(end_time); |
240 | event.commit(); |
241 | processes = processes->next(); |
242 | delete tmp; |
243 | } |
244 | } |
245 | } |
246 | |
247 | TRACE_REQUEST_FUNC(ThreadContextSwitchRate) { |
248 | double rate = 0.0; |
249 | int ret_val = JfrOSInterface::context_switch_rate(&rate); |
250 | if (ret_val == OS_ERR) { |
251 | log_debug(jfr, system)( "Unable to generate requestable event ThreadContextSwitchRate" ); |
252 | return; |
253 | } |
254 | if (ret_val == FUNCTIONALITY_NOT_IMPLEMENTED) { |
255 | return; |
256 | } |
257 | if (ret_val == OS_OK) { |
258 | EventThreadContextSwitchRate event; |
259 | event.set_switchRate((float)rate + 0.0f); |
260 | event.commit(); |
261 | } |
262 | } |
263 | |
264 | #define SEND_FLAGS_OF_TYPE(eventType, flagType) \ |
265 | do { \ |
266 | JVMFlag *flag = JVMFlag::flags; \ |
267 | while (flag->_name != NULL) { \ |
268 | if (flag->is_ ## flagType()) { \ |
269 | if (flag->is_unlocked()) { \ |
270 | Event ## eventType event; \ |
271 | event.set_name(flag->_name); \ |
272 | event.set_value(flag->get_ ## flagType()); \ |
273 | event.set_origin(flag->get_origin()); \ |
274 | event.commit(); \ |
275 | } \ |
276 | } \ |
277 | ++flag; \ |
278 | } \ |
279 | } while (0) |
280 | |
281 | TRACE_REQUEST_FUNC(IntFlag) { |
282 | SEND_FLAGS_OF_TYPE(IntFlag, int); |
283 | } |
284 | |
285 | TRACE_REQUEST_FUNC(UnsignedIntFlag) { |
286 | SEND_FLAGS_OF_TYPE(UnsignedIntFlag, uint); |
287 | } |
288 | |
289 | TRACE_REQUEST_FUNC(LongFlag) { |
290 | SEND_FLAGS_OF_TYPE(LongFlag, intx); |
291 | } |
292 | |
293 | TRACE_REQUEST_FUNC(UnsignedLongFlag) { |
294 | SEND_FLAGS_OF_TYPE(UnsignedLongFlag, uintx); |
295 | SEND_FLAGS_OF_TYPE(UnsignedLongFlag, uint64_t); |
296 | SEND_FLAGS_OF_TYPE(UnsignedLongFlag, size_t); |
297 | } |
298 | |
299 | TRACE_REQUEST_FUNC(DoubleFlag) { |
300 | SEND_FLAGS_OF_TYPE(DoubleFlag, double); |
301 | } |
302 | |
303 | TRACE_REQUEST_FUNC(BooleanFlag) { |
304 | SEND_FLAGS_OF_TYPE(BooleanFlag, bool); |
305 | } |
306 | |
307 | TRACE_REQUEST_FUNC(StringFlag) { |
308 | SEND_FLAGS_OF_TYPE(StringFlag, ccstr); |
309 | } |
310 | |
311 | class VM_GC_SendObjectCountEvent : public VM_GC_HeapInspection { |
312 | public: |
313 | VM_GC_SendObjectCountEvent() : VM_GC_HeapInspection(NULL, true) {} |
314 | virtual void doit() { |
315 | ObjectCountEventSender::enable_requestable_event(); |
316 | collect(); |
317 | ObjectCountEventSender::disable_requestable_event(); |
318 | } |
319 | }; |
320 | |
321 | TRACE_REQUEST_FUNC(ObjectCount) { |
322 | VM_GC_SendObjectCountEvent op; |
323 | VMThread::execute(&op); |
324 | } |
325 | |
326 | class VM_G1SendHeapRegionInfoEvents : public VM_Operation { |
327 | virtual void doit() { |
328 | G1HeapRegionEventSender::send_events(); |
329 | } |
330 | virtual VMOp_Type type() const { return VMOp_HeapIterateOperation; } |
331 | }; |
332 | |
333 | TRACE_REQUEST_FUNC(G1HeapRegionInformation) { |
334 | if (UseG1GC) { |
335 | VM_G1SendHeapRegionInfoEvents op; |
336 | VMThread::execute(&op); |
337 | } |
338 | } |
339 | |
340 | // Java Mission Control (JMC) uses (Java) Long.MIN_VALUE to describe that a |
341 | // long value is undefined. |
342 | static jlong jmc_undefined_long = min_jlong; |
343 | |
344 | TRACE_REQUEST_FUNC(GCConfiguration) { |
345 | GCConfiguration conf; |
346 | jlong pause_target = conf.has_pause_target_default_value() ? jmc_undefined_long : conf.pause_target(); |
347 | EventGCConfiguration event; |
348 | event.set_youngCollector(conf.young_collector()); |
349 | event.set_oldCollector(conf.old_collector()); |
350 | event.set_parallelGCThreads(conf.num_parallel_gc_threads()); |
351 | event.set_concurrentGCThreads(conf.num_concurrent_gc_threads()); |
352 | event.set_usesDynamicGCThreads(conf.uses_dynamic_gc_threads()); |
353 | event.set_isExplicitGCConcurrent(conf.is_explicit_gc_concurrent()); |
354 | event.set_isExplicitGCDisabled(conf.is_explicit_gc_disabled()); |
355 | event.set_gcTimeRatio(conf.gc_time_ratio()); |
356 | event.set_pauseTarget((s8)pause_target); |
357 | event.commit(); |
358 | } |
359 | |
360 | TRACE_REQUEST_FUNC(GCTLABConfiguration) { |
361 | GCTLABConfiguration conf; |
362 | EventGCTLABConfiguration event; |
363 | event.set_usesTLABs(conf.uses_tlabs()); |
364 | event.set_minTLABSize(conf.min_tlab_size()); |
365 | event.set_tlabRefillWasteLimit(conf.tlab_refill_waste_limit()); |
366 | event.commit(); |
367 | } |
368 | |
369 | TRACE_REQUEST_FUNC(GCSurvivorConfiguration) { |
370 | GCSurvivorConfiguration conf; |
371 | EventGCSurvivorConfiguration event; |
372 | event.set_maxTenuringThreshold(conf.max_tenuring_threshold()); |
373 | event.set_initialTenuringThreshold(conf.initial_tenuring_threshold()); |
374 | event.commit(); |
375 | } |
376 | |
377 | TRACE_REQUEST_FUNC(GCHeapConfiguration) { |
378 | GCHeapConfiguration conf; |
379 | EventGCHeapConfiguration event; |
380 | event.set_minSize(conf.min_size()); |
381 | event.set_maxSize(conf.max_size()); |
382 | event.set_initialSize(conf.initial_size()); |
383 | event.set_usesCompressedOops(conf.uses_compressed_oops()); |
384 | event.set_compressedOopsMode(conf.narrow_oop_mode()); |
385 | event.set_objectAlignment(conf.object_alignment_in_bytes()); |
386 | event.set_heapAddressBits(conf.heap_address_size_in_bits()); |
387 | event.commit(); |
388 | } |
389 | |
390 | TRACE_REQUEST_FUNC(YoungGenerationConfiguration) { |
391 | GCYoungGenerationConfiguration conf; |
392 | jlong max_size = conf.has_max_size_default_value() ? jmc_undefined_long : conf.max_size(); |
393 | EventYoungGenerationConfiguration event; |
394 | event.set_maxSize((u8)max_size); |
395 | event.set_minSize(conf.min_size()); |
396 | event.set_newRatio(conf.new_ratio()); |
397 | event.commit(); |
398 | } |
399 | |
400 | TRACE_REQUEST_FUNC(InitialSystemProperty) { |
401 | SystemProperty* p = Arguments::system_properties(); |
402 | JfrTicks time_stamp = JfrTicks::now(); |
403 | while (p != NULL) { |
404 | if (!p->internal()) { |
405 | EventInitialSystemProperty event(UNTIMED); |
406 | event.set_key(p->key()); |
407 | event.set_value(p->value()); |
408 | event.set_endtime(time_stamp); |
409 | event.commit(); |
410 | } |
411 | p = p->next(); |
412 | } |
413 | } |
414 | |
415 | TRACE_REQUEST_FUNC(ThreadAllocationStatistics) { |
416 | ResourceMark rm; |
417 | int initial_size = Threads::number_of_threads(); |
418 | GrowableArray<jlong> allocated(initial_size); |
419 | GrowableArray<traceid> thread_ids(initial_size); |
420 | JfrTicks time_stamp = JfrTicks::now(); |
421 | { |
422 | // Collect allocation statistics while holding threads lock |
423 | MutexLocker ml(Threads_lock); |
424 | for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) { |
425 | allocated.append(jt->cooked_allocated_bytes()); |
426 | thread_ids.append(JFR_THREAD_ID(jt)); |
427 | } |
428 | } |
429 | |
430 | // Write allocation statistics to buffer. |
431 | for(int i = 0; i < thread_ids.length(); i++) { |
432 | EventThreadAllocationStatistics event(UNTIMED); |
433 | event.set_allocated(allocated.at(i)); |
434 | event.set_thread(thread_ids.at(i)); |
435 | event.set_endtime(time_stamp); |
436 | event.commit(); |
437 | } |
438 | } |
439 | |
440 | /** |
441 | * PhysicalMemory event represents: |
442 | * |
443 | * @totalSize == The amount of physical memory (hw) installed and reported by the OS, in bytes. |
444 | * @usedSize == The amount of physical memory currently in use in the system (reserved/committed), in bytes. |
445 | * |
446 | * Both fields are systemwide, i.e. represents the entire OS/HW environment. |
447 | * These fields do not include virtual memory. |
448 | * |
449 | * If running inside a guest OS on top of a hypervisor in a virtualized environment, |
450 | * the total memory reported is the amount of memory configured for the guest OS by the hypervisor. |
451 | */ |
452 | TRACE_REQUEST_FUNC(PhysicalMemory) { |
453 | u8 totalPhysicalMemory = os::physical_memory(); |
454 | EventPhysicalMemory event; |
455 | event.set_totalSize(totalPhysicalMemory); |
456 | event.set_usedSize(totalPhysicalMemory - os::available_memory()); |
457 | event.commit(); |
458 | } |
459 | |
460 | TRACE_REQUEST_FUNC(JavaThreadStatistics) { |
461 | EventJavaThreadStatistics event; |
462 | event.set_activeCount(ThreadService::get_live_thread_count()); |
463 | event.set_daemonCount(ThreadService::get_daemon_thread_count()); |
464 | event.set_accumulatedCount(ThreadService::get_total_thread_count()); |
465 | event.set_peakCount(ThreadService::get_peak_thread_count()); |
466 | event.commit(); |
467 | } |
468 | |
469 | TRACE_REQUEST_FUNC(ClassLoadingStatistics) { |
470 | EventClassLoadingStatistics event; |
471 | event.set_loadedClassCount(ClassLoadingService::loaded_class_count()); |
472 | event.set_unloadedClassCount(ClassLoadingService::unloaded_class_count()); |
473 | event.commit(); |
474 | } |
475 | |
476 | class JfrClassLoaderStatsClosure : public ClassLoaderStatsClosure { |
477 | public: |
478 | JfrClassLoaderStatsClosure() : ClassLoaderStatsClosure(NULL) {} |
479 | |
480 | bool do_entry(oop const& key, ClassLoaderStats* const& cls) { |
481 | const ClassLoaderData* this_cld = cls->_class_loader != NULL ? |
482 | java_lang_ClassLoader::loader_data_acquire(cls->_class_loader) : NULL; |
483 | const ClassLoaderData* parent_cld = cls->_parent != NULL ? |
484 | java_lang_ClassLoader::loader_data_acquire(cls->_parent) : NULL; |
485 | EventClassLoaderStatistics event; |
486 | event.set_classLoader(this_cld); |
487 | event.set_parentClassLoader(parent_cld); |
488 | event.set_classLoaderData((intptr_t)cls->_cld); |
489 | event.set_classCount(cls->_classes_count); |
490 | event.set_chunkSize(cls->_chunk_sz); |
491 | event.set_blockSize(cls->_block_sz); |
492 | event.set_unsafeAnonymousClassCount(cls->_anon_classes_count); |
493 | event.set_unsafeAnonymousChunkSize(cls->_anon_chunk_sz); |
494 | event.set_unsafeAnonymousBlockSize(cls->_anon_block_sz); |
495 | event.commit(); |
496 | return true; |
497 | } |
498 | |
499 | void createEvents(void) { |
500 | _stats->iterate(this); |
501 | } |
502 | }; |
503 | |
504 | class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation { |
505 | public: |
506 | JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { } |
507 | |
508 | void doit() { |
509 | JfrClassLoaderStatsClosure clsc; |
510 | ClassLoaderDataGraph::loaded_cld_do(&clsc); |
511 | clsc.createEvents(); |
512 | } |
513 | }; |
514 | |
515 | TRACE_REQUEST_FUNC(ClassLoaderStatistics) { |
516 | JfrClassLoaderStatsVMOperation op; |
517 | VMThread::execute(&op); |
518 | } |
519 | |
520 | template<typename EVENT> |
521 | static void emit_table_statistics(TableStatistics statistics) { |
522 | EVENT event; |
523 | event.set_bucketCount(statistics._number_of_buckets); |
524 | event.set_entryCount(statistics._number_of_entries); |
525 | event.set_totalFootprint(statistics._total_footprint); |
526 | event.set_bucketCountMaximum(statistics._maximum_bucket_size); |
527 | event.set_bucketCountAverage(statistics._average_bucket_size); |
528 | event.set_bucketCountVariance(statistics._variance_of_bucket_size); |
529 | event.set_bucketCountStandardDeviation(statistics._stddev_of_bucket_size); |
530 | event.set_insertionRate(statistics._add_rate); |
531 | event.set_removalRate(statistics._remove_rate); |
532 | event.commit(); |
533 | } |
534 | |
535 | TRACE_REQUEST_FUNC(SymbolTableStatistics) { |
536 | TableStatistics statistics = SymbolTable::get_table_statistics(); |
537 | emit_table_statistics<EventSymbolTableStatistics>(statistics); |
538 | } |
539 | |
540 | TRACE_REQUEST_FUNC(StringTableStatistics) { |
541 | TableStatistics statistics = StringTable::get_table_statistics(); |
542 | emit_table_statistics<EventStringTableStatistics>(statistics); |
543 | } |
544 | |
545 | TRACE_REQUEST_FUNC(PlaceholderTableStatistics) { |
546 | TableStatistics statistics = SystemDictionary::placeholders_statistics(); |
547 | emit_table_statistics<EventPlaceholderTableStatistics>(statistics); |
548 | } |
549 | |
550 | TRACE_REQUEST_FUNC(LoaderConstraintsTableStatistics) { |
551 | TableStatistics statistics = SystemDictionary::loader_constraints_statistics(); |
552 | emit_table_statistics<EventLoaderConstraintsTableStatistics>(statistics); |
553 | } |
554 | |
555 | TRACE_REQUEST_FUNC(ProtectionDomainCacheTableStatistics) { |
556 | TableStatistics statistics = SystemDictionary::protection_domain_cache_statistics(); |
557 | emit_table_statistics<EventProtectionDomainCacheTableStatistics>(statistics); |
558 | } |
559 | |
560 | TRACE_REQUEST_FUNC(CompilerStatistics) { |
561 | EventCompilerStatistics event; |
562 | event.set_compileCount(CompileBroker::get_total_compile_count()); |
563 | event.set_bailoutCount(CompileBroker::get_total_bailout_count()); |
564 | event.set_invalidatedCount(CompileBroker::get_total_invalidated_count()); |
565 | event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count()); |
566 | event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count()); |
567 | event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled()); |
568 | event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled()); |
569 | event.set_nmetodsSize(CompileBroker::get_sum_nmethod_size()); |
570 | event.set_nmetodCodeSize(CompileBroker::get_sum_nmethod_code_size()); |
571 | event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time()); |
572 | event.set_totalTimeSpent(CompileBroker::get_total_compilation_time()); |
573 | event.commit(); |
574 | } |
575 | |
576 | TRACE_REQUEST_FUNC(CompilerConfiguration) { |
577 | EventCompilerConfiguration event; |
578 | event.set_threadCount(CICompilerCount); |
579 | event.set_tieredCompilation(TieredCompilation); |
580 | event.commit(); |
581 | } |
582 | |
583 | TRACE_REQUEST_FUNC(CodeCacheStatistics) { |
584 | // Emit stats for all available code heaps |
585 | for (int bt = 0; bt < CodeBlobType::NumTypes; ++bt) { |
586 | if (CodeCache::heap_available(bt)) { |
587 | EventCodeCacheStatistics event; |
588 | event.set_codeBlobType((u1)bt); |
589 | event.set_startAddress((u8)CodeCache::low_bound(bt)); |
590 | event.set_reservedTopAddress((u8)CodeCache::high_bound(bt)); |
591 | event.set_entryCount(CodeCache::blob_count(bt)); |
592 | event.set_methodCount(CodeCache::nmethod_count(bt)); |
593 | event.set_adaptorCount(CodeCache::adapter_count(bt)); |
594 | event.set_unallocatedCapacity(CodeCache::unallocated_capacity(bt)); |
595 | event.set_fullCount(CodeCache::get_codemem_full_count(bt)); |
596 | event.commit(); |
597 | } |
598 | } |
599 | } |
600 | |
601 | TRACE_REQUEST_FUNC(CodeCacheConfiguration) { |
602 | EventCodeCacheConfiguration event; |
603 | event.set_initialSize(InitialCodeCacheSize); |
604 | event.set_reservedSize(ReservedCodeCacheSize); |
605 | event.set_nonNMethodSize(NonNMethodCodeHeapSize); |
606 | event.set_profiledSize(ProfiledCodeHeapSize); |
607 | event.set_nonProfiledSize(NonProfiledCodeHeapSize); |
608 | event.set_expansionSize(CodeCacheExpansionSize); |
609 | event.set_minBlockLength(CodeCacheMinBlockLength); |
610 | event.set_startAddress((u8)CodeCache::low_bound()); |
611 | event.set_reservedTopAddress((u8)CodeCache::high_bound()); |
612 | event.commit(); |
613 | } |
614 | |
615 | TRACE_REQUEST_FUNC(CodeSweeperStatistics) { |
616 | EventCodeSweeperStatistics event; |
617 | event.set_sweepCount(NMethodSweeper::traversal_count()); |
618 | event.set_methodReclaimedCount(NMethodSweeper::total_nof_methods_reclaimed()); |
619 | event.set_totalSweepTime(NMethodSweeper::total_time_sweeping()); |
620 | event.set_peakFractionTime(NMethodSweeper::peak_sweep_fraction_time()); |
621 | event.set_peakSweepTime(NMethodSweeper::peak_sweep_time()); |
622 | event.commit(); |
623 | } |
624 | |
625 | TRACE_REQUEST_FUNC(CodeSweeperConfiguration) { |
626 | EventCodeSweeperConfiguration event; |
627 | event.set_sweeperEnabled(MethodFlushing); |
628 | event.set_flushingEnabled(UseCodeCacheFlushing); |
629 | event.commit(); |
630 | } |
631 | |
632 | |
633 | TRACE_REQUEST_FUNC(ShenandoahHeapRegionInformation) { |
634 | #if INCLUDE_SHENANDOAHGC |
635 | if (UseShenandoahGC) { |
636 | VM_ShenandoahSendHeapRegionInfoEvents op; |
637 | VMThread::execute(&op); |
638 | } |
639 | #endif |
640 | } |
641 | |
642 | |