< prev index next >

src/share/vm/jfr/periodic/jfrPeriodic.cpp

Print this page
rev 9055 : 8223438: add VirtualizationInformation JFR event
Reviewed-by: clanger, egahlin
rev 9056 : 8185525: Add JFR event for DictionarySizes
Summary: Added TableStatistics event
Reviewed-by: egahlin, coleenp


   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_implementation/g1/g1HeapRegionEventSender.hpp"
  32 #include "gc_implementation/shared/gcConfiguration.hpp"
  33 #include "gc_implementation/shared/gcTrace.hpp"
  34 #include "gc_implementation/shared/objectCountEventSender.hpp"
  35 #include "gc_implementation/shared/vmGCOperations.hpp"
  36 #include "jfr/jfrEvents.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 "memory/heapInspection.hpp"
  46 #include "memory/resourceArea.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "runtime/arguments.hpp"


  70   EventJVMInformation event;
  71   event.set_jvmName(VM_Version::vm_name());
  72   event.set_jvmVersion(VM_Version::internal_vm_info_string());
  73   event.set_javaArguments(Arguments::java_command());
  74   event.set_jvmArguments(Arguments::jvm_args());
  75   event.set_jvmFlags(Arguments::jvm_flags());
  76   event.set_jvmStartTime(Management::vm_init_done_time());
  77   event.set_pid(os::current_process_id());
  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 /*
  91  * This is left empty on purpose, having ExecutionSample as a requestable
  92  * is a way of getting the period. The period is passed to ThreadSampling::update_period.
  93  * Implementation in jfrSamples.cpp
  94  */
  95 TRACE_REQUEST_FUNC(ExecutionSample) {
  96 }
  97 TRACE_REQUEST_FUNC(NativeMethodSample) {
  98 }
  99 
 100 TRACE_REQUEST_FUNC(ThreadDump) {
 101   ResourceMark rm;
 102   EventThreadDump event;
 103   event.set_result(JfrDcmdEvent::thread_dump());
 104   event.commit();
 105 }
 106 
 107 static int _native_library_callback(const char* name, address base, address top, void *param) {
 108   EventNativeLibrary event(UNTIMED);
 109   event.set_name(name);


 473 
 474   void createEvents(void) {
 475     _stats->iterate(this);
 476   }
 477 };
 478 
 479 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
 480  public:
 481   JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
 482 
 483   void doit() {
 484     JfrClassLoaderStatsClosure clsc;
 485     ClassLoaderDataGraph::cld_do(&clsc);
 486     clsc.createEvents();
 487   }
 488 };
 489 
 490 TRACE_REQUEST_FUNC(ClassLoaderStatistics) {
 491   JfrClassLoaderStatsVMOperation op;
 492   VMThread::execute(&op);








































 493 }
 494 
 495 TRACE_REQUEST_FUNC(CompilerStatistics) {
 496   EventCompilerStatistics event;
 497   event.set_compileCount(CompileBroker::get_total_compile_count());
 498   event.set_bailoutCount(CompileBroker::get_total_bailout_count());
 499   event.set_invalidatedCount(CompileBroker::get_total_invalidated_count());
 500   event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count());
 501   event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count());
 502   event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled());
 503   event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled());
 504   event.set_nmetodsSize(CompileBroker::get_sum_nmethod_size());
 505   event.set_nmetodCodeSize(CompileBroker::get_sum_nmethod_code_size());
 506   event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time());
 507   event.set_totalTimeSpent(CompileBroker::get_total_compilation_time());
 508   event.commit();
 509 }
 510 
 511 TRACE_REQUEST_FUNC(CompilerConfiguration) {
 512   EventCompilerConfiguration event;




   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 "classfile/symbolTable.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "code/codeCache.hpp"
  32 #include "compiler/compileBroker.hpp"
  33 #include "gc_implementation/g1/g1HeapRegionEventSender.hpp"
  34 #include "gc_implementation/shared/gcConfiguration.hpp"
  35 #include "gc_implementation/shared/gcTrace.hpp"
  36 #include "gc_implementation/shared/objectCountEventSender.hpp"
  37 #include "gc_implementation/shared/vmGCOperations.hpp"
  38 #include "jfr/jfrEvents.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 "memory/heapInspection.hpp"
  48 #include "memory/resourceArea.hpp"
  49 #include "oops/oop.inline.hpp"
  50 #include "runtime/arguments.hpp"


  72   EventJVMInformation event;
  73   event.set_jvmName(VM_Version::vm_name());
  74   event.set_jvmVersion(VM_Version::internal_vm_info_string());
  75   event.set_javaArguments(Arguments::java_command());
  76   event.set_jvmArguments(Arguments::jvm_args());
  77   event.set_jvmFlags(Arguments::jvm_flags());
  78   event.set_jvmStartTime(Management::vm_init_done_time());
  79   event.set_pid(os::current_process_id());
  80   event.commit();
  81  }
  82 
  83 TRACE_REQUEST_FUNC(OSInformation) {
  84   ResourceMark rm;
  85   char* os_name = NEW_RESOURCE_ARRAY(char, 2048);
  86   JfrOSInterface::os_version(&os_name);
  87   EventOSInformation event;
  88   event.set_osVersion(os_name);
  89   event.commit();
  90 }
  91 
  92 TRACE_REQUEST_FUNC(VirtualizationInformation) {
  93   EventVirtualizationInformation event;
  94   event.set_name(JfrOSInterface::virtualization_name());
  95   event.commit();
  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);


 481 
 482   void createEvents(void) {
 483     _stats->iterate(this);
 484   }
 485 };
 486 
 487 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
 488  public:
 489   JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
 490 
 491   void doit() {
 492     JfrClassLoaderStatsClosure clsc;
 493     ClassLoaderDataGraph::cld_do(&clsc);
 494     clsc.createEvents();
 495   }
 496 };
 497 
 498 TRACE_REQUEST_FUNC(ClassLoaderStatistics) {
 499   JfrClassLoaderStatsVMOperation op;
 500   VMThread::execute(&op);
 501 }
 502 
 503 template<typename EVENT>
 504 static void emit_table_statistics(TableStatistics statistics) {
 505   EVENT event;
 506   event.set_bucketCount(statistics._number_of_buckets);
 507   event.set_entryCount(statistics._number_of_entries);
 508   event.set_totalFootprint(statistics._total_footprint);
 509   event.set_bucketCountMaximum(statistics._maximum_bucket_size);
 510   event.set_bucketCountAverage(statistics._average_bucket_size);
 511   event.set_bucketCountVariance(statistics._variance_of_bucket_size);
 512   event.set_bucketCountStandardDeviation(statistics._stddev_of_bucket_size);
 513   event.set_insertionRate(statistics._add_rate);
 514   event.set_removalRate(statistics._remove_rate);
 515   event.commit();
 516 }
 517 
 518 TRACE_REQUEST_FUNC(SymbolTableStatistics) {
 519   TableStatistics statistics = SymbolTable::the_table()->get_table_statistics();
 520   emit_table_statistics<EventSymbolTableStatistics>(statistics);
 521 }
 522 
 523 TRACE_REQUEST_FUNC(StringTableStatistics) {
 524   TableStatistics statistics = StringTable::the_table()->get_table_statistics();
 525   emit_table_statistics<EventStringTableStatistics>(statistics);
 526 }
 527 
 528 TRACE_REQUEST_FUNC(PlaceholderTableStatistics) {
 529   TableStatistics statistics = SystemDictionary::placeholders_statistics();
 530   emit_table_statistics<EventPlaceholderTableStatistics>(statistics);
 531 }
 532 
 533 TRACE_REQUEST_FUNC(LoaderConstraintsTableStatistics) {
 534   TableStatistics statistics = SystemDictionary::loader_constraints_statistics();
 535   emit_table_statistics<EventLoaderConstraintsTableStatistics>(statistics);
 536 }
 537 
 538 TRACE_REQUEST_FUNC(ProtectionDomainCacheTableStatistics) {
 539   TableStatistics statistics = SystemDictionary::protection_domain_cache_statistics();
 540   emit_table_statistics<EventProtectionDomainCacheTableStatistics>(statistics);
 541 }
 542 
 543 TRACE_REQUEST_FUNC(CompilerStatistics) {
 544   EventCompilerStatistics event;
 545   event.set_compileCount(CompileBroker::get_total_compile_count());
 546   event.set_bailoutCount(CompileBroker::get_total_bailout_count());
 547   event.set_invalidatedCount(CompileBroker::get_total_invalidated_count());
 548   event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count());
 549   event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count());
 550   event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled());
 551   event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled());
 552   event.set_nmetodsSize(CompileBroker::get_sum_nmethod_size());
 553   event.set_nmetodCodeSize(CompileBroker::get_sum_nmethod_code_size());
 554   event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time());
 555   event.set_totalTimeSpent(CompileBroker::get_total_compilation_time());
 556   event.commit();
 557 }
 558 
 559 TRACE_REQUEST_FUNC(CompilerConfiguration) {
 560   EventCompilerConfiguration event;


< prev index next >