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