< prev index next >

src/share/vm/runtime/fprofiler.cpp

Print this page
rev 9019 : [mq]: format.patch


  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "code/codeCache.hpp"
  28 #include "code/vtableStubs.hpp"
  29 #include "gc/shared/collectedHeap.inline.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/universe.inline.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "oops/symbol.hpp"
  35 #include "runtime/deoptimization.hpp"
  36 #include "runtime/fprofiler.hpp"
  37 #include "runtime/mutexLocker.hpp"
  38 #include "runtime/stubCodeGenerator.hpp"
  39 #include "runtime/stubRoutines.hpp"
  40 #include "runtime/task.hpp"
  41 #include "runtime/thread.inline.hpp"
  42 #include "runtime/vframe.hpp"
  43 #include "utilities/macros.hpp"
  44 
  45 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  46 
  47 // Static fields of FlatProfiler
  48 int               FlatProfiler::received_gc_ticks   = 0;
  49 int               FlatProfiler::vm_operation_ticks  = 0;
  50 int               FlatProfiler::threads_lock_ticks  = 0;
  51 int               FlatProfiler::class_loader_ticks  = 0;
  52 int               FlatProfiler::extra_ticks         = 0;
  53 int               FlatProfiler::blocked_ticks       = 0;
  54 int               FlatProfiler::deopt_ticks         = 0;
  55 int               FlatProfiler::unknown_ticks       = 0;
  56 int               FlatProfiler::interpreter_ticks   = 0;
  57 int               FlatProfiler::compiler_ticks      = 0;
  58 int               FlatProfiler::received_ticks      = 0;
  59 int               FlatProfiler::delivered_ticks     = 0;
  60 int*              FlatProfiler::bytecode_ticks      = NULL;
  61 int*              FlatProfiler::bytecode_ticks_stub = NULL;
  62 int               FlatProfiler::all_int_ticks       = 0;
  63 int               FlatProfiler::all_comp_ticks      = 0;
  64 int               FlatProfiler::all_ticks           = 0;
  65 bool              FlatProfiler::full_profile_flag   = false;
  66 ThreadProfiler*   FlatProfiler::thread_profiler     = NULL;


 169 
 170 void PCRecorder::record(address pc) {
 171   if (counters == NULL) return;
 172   assert(CodeCache::contains(pc), "must be in CodeCache");
 173   counters[index_for(pc)]++;
 174 }
 175 
 176 
 177 address FlatProfiler::bucket_start_for(address pc) {
 178   return PCRecorder::bucket_start_for(pc);
 179 }
 180 
 181 int FlatProfiler::bucket_count_for(address pc) {
 182   return PCRecorder::bucket_count_for(pc);
 183 }
 184 
 185 void PCRecorder::print() {
 186   if (counters == NULL) return;
 187 
 188   tty->cr();
 189   tty->print_cr("Printing compiled methods with PC buckets having more than %d ticks", ProfilerPCTickThreshold);
 190   tty->print_cr("===================================================================");
 191   tty->cr();
 192 
 193   GrowableArray<CodeBlob*>* candidates = new GrowableArray<CodeBlob*>(20);
 194 
 195 
 196   int s;
 197   {
 198     MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 199     s = size();
 200   }
 201 
 202   for (int index = 0; index < s; index++) {
 203     int count = counters[index];
 204     if (count > ProfilerPCTickThreshold) {
 205       address pc = pc_for(index);
 206       CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 207       if (cb != NULL && candidates->find(cb) < 0) {
 208         candidates->push(cb);
 209       }


1477 
1478   if (blocked_ticks + class_loader_ticks + interpreter_ticks + compiler_ticks + unknown_ticks() != 0) {
1479     tty->fill_to(col1);
1480     tty->print_cr("Thread-local ticks:");
1481     print_ticks("Blocked (of total)",  blocked_ticks,      total);
1482     print_ticks("Class loader",        class_loader_ticks, active);
1483     print_ticks("Extra",               extra_ticks,        active);
1484     print_ticks("Interpreter",         interpreter_ticks,  active);
1485     print_ticks("Compilation",         compiler_ticks,     active);
1486     print_ticks("Unknown: vtable stubs",  unknown_ticks_array[ut_vtable_stubs],         active);
1487     print_ticks("Unknown: null method",   unknown_ticks_array[ut_null_method],          active);
1488     print_ticks("Unknown: running frame", unknown_ticks_array[ut_running_frame],        active);
1489     print_ticks("Unknown: calling frame", unknown_ticks_array[ut_calling_frame],        active);
1490     print_ticks("Unknown: no pc",         unknown_ticks_array[ut_no_pc],                active);
1491     print_ticks("Unknown: no last frame", unknown_ticks_array[ut_no_last_Java_frame],   active);
1492     print_ticks("Unknown: thread_state",  unknown_ticks_array[ut_unknown_thread_state], active);
1493     tty->cr();
1494   }
1495 
1496   if (WizardMode) {
1497     tty->print_cr("Node area used: %dKb", (area_top - area_bottom) / 1024);
1498   }
1499   reset();
1500 }
1501 
1502 /*
1503 ThreadProfiler::print_unknown(){
1504   if (table == NULL) {
1505     return;
1506   }
1507 
1508   if (thread_ticks <= 0) {
1509     return;
1510   }
1511 } */
1512 
1513 void FlatProfiler::print(int unused) {
1514   ResourceMark rm;
1515   if (thread_profiler != NULL) {
1516     thread_profiler->print("All threads");
1517   } else {




  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "code/codeCache.hpp"
  28 #include "code/vtableStubs.hpp"
  29 #include "gc/shared/collectedHeap.inline.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/universe.inline.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "oops/symbol.hpp"
  35 #include "runtime/deoptimization.hpp"
  36 #include "runtime/fprofiler.hpp"
  37 #include "runtime/mutexLocker.hpp"
  38 #include "runtime/stubCodeGenerator.hpp"
  39 #include "runtime/stubRoutines.hpp"
  40 #include "runtime/task.hpp"
  41 #include "runtime/thread.inline.hpp"
  42 #include "runtime/vframe.hpp"
  43 #include "utilities/macros.hpp"
  44 


  45 // Static fields of FlatProfiler
  46 int               FlatProfiler::received_gc_ticks   = 0;
  47 int               FlatProfiler::vm_operation_ticks  = 0;
  48 int               FlatProfiler::threads_lock_ticks  = 0;
  49 int               FlatProfiler::class_loader_ticks  = 0;
  50 int               FlatProfiler::extra_ticks         = 0;
  51 int               FlatProfiler::blocked_ticks       = 0;
  52 int               FlatProfiler::deopt_ticks         = 0;
  53 int               FlatProfiler::unknown_ticks       = 0;
  54 int               FlatProfiler::interpreter_ticks   = 0;
  55 int               FlatProfiler::compiler_ticks      = 0;
  56 int               FlatProfiler::received_ticks      = 0;
  57 int               FlatProfiler::delivered_ticks     = 0;
  58 int*              FlatProfiler::bytecode_ticks      = NULL;
  59 int*              FlatProfiler::bytecode_ticks_stub = NULL;
  60 int               FlatProfiler::all_int_ticks       = 0;
  61 int               FlatProfiler::all_comp_ticks      = 0;
  62 int               FlatProfiler::all_ticks           = 0;
  63 bool              FlatProfiler::full_profile_flag   = false;
  64 ThreadProfiler*   FlatProfiler::thread_profiler     = NULL;


 167 
 168 void PCRecorder::record(address pc) {
 169   if (counters == NULL) return;
 170   assert(CodeCache::contains(pc), "must be in CodeCache");
 171   counters[index_for(pc)]++;
 172 }
 173 
 174 
 175 address FlatProfiler::bucket_start_for(address pc) {
 176   return PCRecorder::bucket_start_for(pc);
 177 }
 178 
 179 int FlatProfiler::bucket_count_for(address pc) {
 180   return PCRecorder::bucket_count_for(pc);
 181 }
 182 
 183 void PCRecorder::print() {
 184   if (counters == NULL) return;
 185 
 186   tty->cr();
 187   tty->print_cr("Printing compiled methods with PC buckets having more than " INTX_FORMAT " ticks", ProfilerPCTickThreshold);
 188   tty->print_cr("===================================================================");
 189   tty->cr();
 190 
 191   GrowableArray<CodeBlob*>* candidates = new GrowableArray<CodeBlob*>(20);
 192 
 193 
 194   int s;
 195   {
 196     MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 197     s = size();
 198   }
 199 
 200   for (int index = 0; index < s; index++) {
 201     int count = counters[index];
 202     if (count > ProfilerPCTickThreshold) {
 203       address pc = pc_for(index);
 204       CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 205       if (cb != NULL && candidates->find(cb) < 0) {
 206         candidates->push(cb);
 207       }


1475 
1476   if (blocked_ticks + class_loader_ticks + interpreter_ticks + compiler_ticks + unknown_ticks() != 0) {
1477     tty->fill_to(col1);
1478     tty->print_cr("Thread-local ticks:");
1479     print_ticks("Blocked (of total)",  blocked_ticks,      total);
1480     print_ticks("Class loader",        class_loader_ticks, active);
1481     print_ticks("Extra",               extra_ticks,        active);
1482     print_ticks("Interpreter",         interpreter_ticks,  active);
1483     print_ticks("Compilation",         compiler_ticks,     active);
1484     print_ticks("Unknown: vtable stubs",  unknown_ticks_array[ut_vtable_stubs],         active);
1485     print_ticks("Unknown: null method",   unknown_ticks_array[ut_null_method],          active);
1486     print_ticks("Unknown: running frame", unknown_ticks_array[ut_running_frame],        active);
1487     print_ticks("Unknown: calling frame", unknown_ticks_array[ut_calling_frame],        active);
1488     print_ticks("Unknown: no pc",         unknown_ticks_array[ut_no_pc],                active);
1489     print_ticks("Unknown: no last frame", unknown_ticks_array[ut_no_last_Java_frame],   active);
1490     print_ticks("Unknown: thread_state",  unknown_ticks_array[ut_unknown_thread_state], active);
1491     tty->cr();
1492   }
1493 
1494   if (WizardMode) {
1495     tty->print_cr("Node area used: " INTX_FORMAT "Kb", (intx)((area_top - area_bottom) / 1024));
1496   }
1497   reset();
1498 }
1499 
1500 /*
1501 ThreadProfiler::print_unknown(){
1502   if (table == NULL) {
1503     return;
1504   }
1505 
1506   if (thread_ticks <= 0) {
1507     return;
1508   }
1509 } */
1510 
1511 void FlatProfiler::print(int unused) {
1512   ResourceMark rm;
1513   if (thread_profiler != NULL) {
1514     thread_profiler->print("All threads");
1515   } else {


< prev index next >