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/shared/gcConfiguration.hpp"
  32 #include "gc/shared/gcTrace.hpp"
  33 #include "gc/shared/objectCountEventSender.hpp"
  34 #include "gc/shared/vmGCOperations.hpp"
  35 #include "jfr/jfrEvents.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/periodic/jfrNetworkUtilization.hpp"
  41 #include "jfr/recorder/jfrRecorder.hpp"
  42 #include "jfr/support/jfrThreadId.hpp"
  43 #include "jfr/utilities/jfrTime.hpp"
  44 #include "jfrfiles/jfrPeriodic.hpp"
  45 #include "logging/log.hpp"
  46 #include "memory/heapInspection.hpp"
  47 #include "memory/resourceArea.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "runtime/arguments.hpp"
  50 #include "runtime/flags/jvmFlag.hpp"
  51 #include "runtime/globals.hpp"
  52 #include "runtime/os.hpp"
  53 #include "runtime/os_perf.hpp"
  54 #include "runtime/thread.inline.hpp"
  55 #include "runtime/threadSMR.hpp"
  56 #include "runtime/sweeper.hpp"
  57 #include "runtime/vmThread.hpp"
  58 #include "services/classLoadingService.hpp"
  59 #include "services/management.hpp"
  60 #include "services/threadService.hpp"
  61 #include "utilities/exceptions.hpp"
  62 #include "utilities/globalDefinitions.hpp"
  63 #if INCLUDE_G1GC
  64 #include "gc/g1/g1HeapRegionEventSender.hpp"
  65 #endif
  66 
  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 TRACE_REQUEST_FUNC(G1HeapRegionInformation) {
 323   G1GC_ONLY(G1HeapRegionEventSender::send_events());
 324 }
 325 
 326 // Java Mission Control (JMC) uses (Java) Long.MIN_VALUE to describe that a
 327 // long value is undefined.
 328 static jlong jmc_undefined_long = min_jlong;
 329 
 330 TRACE_REQUEST_FUNC(GCConfiguration) {
 331   GCConfiguration conf;
 332   jlong pause_target = conf.has_pause_target_default_value() ? jmc_undefined_long : conf.pause_target();
 333   EventGCConfiguration event;
 334   event.set_youngCollector(conf.young_collector());
 335   event.set_oldCollector(conf.old_collector());
 336   event.set_parallelGCThreads(conf.num_parallel_gc_threads());
 337   event.set_concurrentGCThreads(conf.num_concurrent_gc_threads());
 338   event.set_usesDynamicGCThreads(conf.uses_dynamic_gc_threads());
 339   event.set_isExplicitGCConcurrent(conf.is_explicit_gc_concurrent());
 340   event.set_isExplicitGCDisabled(conf.is_explicit_gc_disabled());
 341   event.set_gcTimeRatio(conf.gc_time_ratio());
 342   event.set_pauseTarget((s8)pause_target);
 343   event.commit();
 344 }
 345 
 346 TRACE_REQUEST_FUNC(GCTLABConfiguration) {
 347   GCTLABConfiguration conf;
 348   EventGCTLABConfiguration event;
 349   event.set_usesTLABs(conf.uses_tlabs());
 350   event.set_minTLABSize(conf.min_tlab_size());
 351   event.set_tlabRefillWasteLimit(conf.tlab_refill_waste_limit());
 352   event.commit();
 353 }
 354 
 355 TRACE_REQUEST_FUNC(GCSurvivorConfiguration) {
 356   GCSurvivorConfiguration conf;
 357   EventGCSurvivorConfiguration event;
 358   event.set_maxTenuringThreshold(conf.max_tenuring_threshold());
 359   event.set_initialTenuringThreshold(conf.initial_tenuring_threshold());
 360   event.commit();
 361 }
 362 
 363 TRACE_REQUEST_FUNC(GCHeapConfiguration) {
 364   GCHeapConfiguration conf;
 365   EventGCHeapConfiguration event;
 366   event.set_minSize(conf.min_size());
 367   event.set_maxSize(conf.max_size());
 368   event.set_initialSize(conf.initial_size());
 369   event.set_usesCompressedOops(conf.uses_compressed_oops());
 370   event.set_compressedOopsMode(conf.narrow_oop_mode());
 371   event.set_objectAlignment(conf.object_alignment_in_bytes());
 372   event.set_heapAddressBits(conf.heap_address_size_in_bits());
 373   event.commit();
 374 }
 375 
 376 TRACE_REQUEST_FUNC(YoungGenerationConfiguration) {
 377   GCYoungGenerationConfiguration conf;
 378   jlong max_size = conf.has_max_size_default_value() ? jmc_undefined_long : conf.max_size();
 379   EventYoungGenerationConfiguration event;
 380   event.set_maxSize((u8)max_size);
 381   event.set_minSize(conf.min_size());
 382   event.set_newRatio(conf.new_ratio());
 383   event.commit();
 384 }
 385 
 386 TRACE_REQUEST_FUNC(InitialSystemProperty) {
 387   SystemProperty* p = Arguments::system_properties();
 388   JfrTicks time_stamp = JfrTicks::now();
 389   while (p !=  NULL) {
 390     if (!p->internal()) {
 391       EventInitialSystemProperty event(UNTIMED);
 392       event.set_key(p->key());
 393       event.set_value(p->value());
 394       event.set_endtime(time_stamp);
 395       event.commit();
 396     }
 397     p = p->next();
 398   }
 399 }
 400 
 401 TRACE_REQUEST_FUNC(ThreadAllocationStatistics) {
 402   ResourceMark rm;
 403   int initial_size = Threads::number_of_threads();
 404   GrowableArray<jlong> allocated(initial_size);
 405   GrowableArray<traceid> thread_ids(initial_size);
 406   JfrTicks time_stamp = JfrTicks::now();
 407   {
 408     // Collect allocation statistics while holding threads lock
 409     MutexLockerEx ml(Threads_lock);
 410     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
 411       allocated.append(jt->cooked_allocated_bytes());
 412       thread_ids.append(JFR_THREAD_ID(jt));
 413     }
 414   }
 415 
 416   // Write allocation statistics to buffer.
 417   for(int i = 0; i < thread_ids.length(); i++) {
 418     EventThreadAllocationStatistics event(UNTIMED);
 419     event.set_allocated(allocated.at(i));
 420     event.set_thread(thread_ids.at(i));
 421     event.set_endtime(time_stamp);
 422     event.commit();
 423   }
 424 }
 425 
 426 /**
 427  *  PhysicalMemory event represents:
 428  *
 429  *  @totalSize == The amount of physical memory (hw) installed and reported by the OS, in bytes.
 430  *  @usedSize  == The amount of physical memory currently in use in the system (reserved/committed), in bytes.
 431  *
 432  *  Both fields are systemwide, i.e. represents the entire OS/HW environment.
 433  *  These fields do not include virtual memory.
 434  *
 435  *  If running inside a guest OS on top of a hypervisor in a virtualized environment,
 436  *  the total memory reported is the amount of memory configured for the guest OS by the hypervisor.
 437  */
 438 TRACE_REQUEST_FUNC(PhysicalMemory) {
 439   u8 totalPhysicalMemory = os::physical_memory();
 440   EventPhysicalMemory event;
 441   event.set_totalSize(totalPhysicalMemory);
 442   event.set_usedSize(totalPhysicalMemory - os::available_memory());
 443   event.commit();
 444 }
 445 
 446 TRACE_REQUEST_FUNC(JavaThreadStatistics) {
 447   EventJavaThreadStatistics event;
 448   event.set_activeCount(ThreadService::get_live_thread_count());
 449   event.set_daemonCount(ThreadService::get_daemon_thread_count());
 450   event.set_accumulatedCount(ThreadService::get_total_thread_count());
 451   event.set_peakCount(ThreadService::get_peak_thread_count());
 452   event.commit();
 453 }
 454 
 455 TRACE_REQUEST_FUNC(ClassLoadingStatistics) {
 456   EventClassLoadingStatistics event;
 457   event.set_loadedClassCount(ClassLoadingService::loaded_class_count());
 458   event.set_unloadedClassCount(ClassLoadingService::unloaded_class_count());
 459   event.commit();
 460 }
 461 
 462 class JfrClassLoaderStatsClosure : public ClassLoaderStatsClosure {
 463 public:
 464   JfrClassLoaderStatsClosure() : ClassLoaderStatsClosure(NULL) {}
 465 
 466   bool do_entry(oop const& key, ClassLoaderStats* const& cls) {
 467     const ClassLoaderData* this_cld = cls->_class_loader != NULL ?
 468       java_lang_ClassLoader::loader_data(cls->_class_loader) : (ClassLoaderData*)NULL;
 469     const ClassLoaderData* parent_cld = cls->_parent != NULL ?
 470       java_lang_ClassLoader::loader_data(cls->_parent) : (ClassLoaderData*)NULL;
 471     EventClassLoaderStatistics event;
 472     event.set_classLoader(this_cld);
 473     event.set_parentClassLoader(parent_cld);
 474     event.set_classLoaderData((intptr_t)cls->_cld);
 475     event.set_classCount(cls->_classes_count);
 476     event.set_chunkSize(cls->_chunk_sz);
 477     event.set_blockSize(cls->_block_sz);
 478     event.set_anonymousClassCount(cls->_anon_classes_count);
 479     event.set_anonymousChunkSize(cls->_anon_chunk_sz);
 480     event.set_anonymousBlockSize(cls->_anon_block_sz);
 481     event.commit();
 482     return true;
 483   }
 484 
 485   void createEvents(void) {
 486     _stats->iterate(this);
 487   }
 488 };
 489 
 490 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
 491  public:
 492   JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
 493 
 494   void doit() {
 495     JfrClassLoaderStatsClosure clsc;
 496     ClassLoaderDataGraph::cld_do(&clsc);
 497     clsc.createEvents();
 498   }
 499 };
 500 
 501 TRACE_REQUEST_FUNC(ClassLoaderStatistics) {
 502   JfrClassLoaderStatsVMOperation op;
 503   VMThread::execute(&op);
 504 }
 505 
 506 TRACE_REQUEST_FUNC(CompilerStatistics) {
 507   EventCompilerStatistics event;
 508   event.set_compileCount(CompileBroker::get_total_compile_count());
 509   event.set_bailoutCount(CompileBroker::get_total_bailout_count());
 510   event.set_invalidatedCount(CompileBroker::get_total_invalidated_count());
 511   event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count());
 512   event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count());
 513   event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled());
 514   event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled());
 515   event.set_nmethodsSize(CompileBroker::get_sum_nmethod_size());
 516   event.set_nmethodCodeSize(CompileBroker::get_sum_nmethod_code_size());
 517   event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time());
 518   event.set_totalTimeSpent(CompileBroker::get_total_compilation_time());
 519   event.commit();
 520 }
 521 
 522 TRACE_REQUEST_FUNC(CompilerConfiguration) {
 523   EventCompilerConfiguration event;
 524   event.set_threadCount(CICompilerCount);
 525   event.set_tieredCompilation(TieredCompilation);
 526   event.commit();
 527 }
 528 
 529 TRACE_REQUEST_FUNC(CodeCacheStatistics) {
 530   // Emit stats for all available code heaps
 531   for (int bt = 0; bt < CodeBlobType::NumTypes; ++bt) {
 532     if (CodeCache::heap_available(bt)) {
 533       EventCodeCacheStatistics event;
 534       event.set_codeBlobType((u1)bt);
 535       event.set_startAddress((u8)CodeCache::low_bound(bt));
 536       event.set_reservedTopAddress((u8)CodeCache::high_bound(bt));
 537       event.set_entryCount(CodeCache::blob_count(bt));
 538       event.set_methodCount(CodeCache::nmethod_count(bt));
 539       event.set_adaptorCount(CodeCache::adapter_count(bt));
 540       event.set_unallocatedCapacity(CodeCache::unallocated_capacity(bt));
 541       event.set_fullCount(CodeCache::get_codemem_full_count(bt));
 542       event.commit();
 543     }
 544   }
 545 }
 546 
 547 TRACE_REQUEST_FUNC(CodeCacheConfiguration) {
 548   EventCodeCacheConfiguration event;
 549   event.set_initialSize(InitialCodeCacheSize);
 550   event.set_reservedSize(ReservedCodeCacheSize);
 551   event.set_nonNMethodSize(NonNMethodCodeHeapSize);
 552   event.set_profiledSize(ProfiledCodeHeapSize);
 553   event.set_nonProfiledSize(NonProfiledCodeHeapSize);
 554   event.set_expansionSize(CodeCacheExpansionSize);
 555   event.set_minBlockLength(CodeCacheMinBlockLength);
 556   event.set_startAddress((u8)CodeCache::low_bound());
 557   event.set_reservedTopAddress((u8)CodeCache::high_bound());
 558   event.commit();
 559 }
 560 
 561 TRACE_REQUEST_FUNC(CodeSweeperStatistics) {
 562   EventCodeSweeperStatistics event;
 563   event.set_sweepCount(NMethodSweeper::traversal_count());
 564   event.set_methodReclaimedCount(NMethodSweeper::total_nof_methods_reclaimed());
 565   event.set_totalSweepTime(NMethodSweeper::total_time_sweeping());
 566   event.set_peakFractionTime(NMethodSweeper::peak_sweep_fraction_time());
 567   event.set_peakSweepTime(NMethodSweeper::peak_sweep_time());
 568   event.commit();
 569 }
 570 
 571 TRACE_REQUEST_FUNC(CodeSweeperConfiguration) {
 572   EventCodeSweeperConfiguration event;
 573   event.set_sweeperEnabled(MethodFlushing);
 574   event.set_flushingEnabled(UseCodeCacheFlushing);
 575   event.commit();
 576 }