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