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