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