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