< prev index next >

src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp

Print this page
*** 20,10 ***
--- 20,11 ---
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   *
   */
  
+ #include "cds/aotCacheAccess.hpp"
  #include "cds/aotClassInitializer.hpp"
  #include "cds/aotClassLinker.hpp"
  #include "cds/aotLinkedClassBulkLoader.hpp"
  #include "cds/aotLinkedClassTable.hpp"
  #include "cds/cdsConfig.hpp"

*** 40,15 ***
--- 41,25 ---
  #include "oops/instanceKlass.hpp"
  #include "oops/klass.inline.hpp"
  #include "oops/trainingData.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/java.hpp"
+ #include "runtime/perfData.inline.hpp"
  #include "runtime/serviceThread.hpp"
  #include "utilities/growableArray.hpp"
  
+ static PerfCounter* _perf_classes_preloaded = nullptr;
+ static PerfTickCounters* _perf_class_preload_counters = nullptr;
+ 
  void AOTLinkedClassBulkLoader::serialize(SerializeClosure* soc) {
    AOTLinkedClassTable::get()->serialize(soc);
+ 
+   if (soc->reading() && UsePerfData) {
+     JavaThread* THREAD = JavaThread::current();
+     NEWPERFEVENTCOUNTER(_perf_classes_preloaded, SUN_CLS, "preloadedClasses");
+     NEWPERFTICKCOUNTERS(_perf_class_preload_counters, SUN_CLS, "classPreload");
+   }
  }
  
  // This function is called before the VM executes any Java code (include AOT-compiled Java methods).
  //
  // We populate the boot/platform/app class loaders with classes from the AOT cache. This is a fundamental

*** 91,10 ***
--- 102,14 ---
    if (classes == nullptr) {
      return;
    }
  
    for (int i = 0; i < classes->length(); i++) {
+     if (UsePerfData) {
+       _perf_classes_preloaded->inc();
+     }
+ 
      InstanceKlass* ik = classes->at(i);
      if (log_is_enabled(Info, aot, load)) {
        ResourceMark rm(THREAD);
        log_info(aot, load)("%-5s %s%s", category_name, ik->external_name(),
                            ik->is_hidden() ? " (hidden)" : "");

*** 360,5 ***
--- 375,15 ---
      replay_training_at_init(table->boot2(),    CHECK);
      replay_training_at_init(table->platform(), CHECK);
      replay_training_at_init(table->app(),      CHECK);
    }
  }
+ 
+ void AOTLinkedClassBulkLoader::print_counters_on(outputStream* st) {
+   if (UsePerfData && _perf_class_preload_counters != nullptr) {
+     st->print_cr("AOTLinkedClassBulkLoader:");
+     st->print_cr("  preload:           " JLONG_FORMAT_W(6) "us (elapsed) " JLONG_FORMAT_W(6) " (thread) / " JLONG_FORMAT_W(5) " events",
+                  _perf_class_preload_counters->elapsed_counter_value_us(),
+                  _perf_class_preload_counters->thread_counter_value_us(),
+                  _perf_classes_preloaded->get_value());
+   }
+ }
< prev index next >