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