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