hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp
changeset 11192 ff37c2093a0d
parent 10250 0794cd144834
child 11572 84afef481892
equal deleted inserted replaced
11191:d54ab5dcba83 11192:ff37c2093a0d
    28 #include "runtime/arguments.hpp"
    28 #include "runtime/arguments.hpp"
    29 #include "runtime/simpleThresholdPolicy.hpp"
    29 #include "runtime/simpleThresholdPolicy.hpp"
    30 #include "runtime/simpleThresholdPolicy.inline.hpp"
    30 #include "runtime/simpleThresholdPolicy.inline.hpp"
    31 #include "code/scopeDesc.hpp"
    31 #include "code/scopeDesc.hpp"
    32 
    32 
       
    33 
       
    34 void SimpleThresholdPolicy::print_counters(const char* prefix, methodHandle mh) {
       
    35   int invocation_count = mh->invocation_count();
       
    36   int backedge_count = mh->backedge_count();
       
    37   methodDataHandle mdh = mh->method_data();
       
    38   int mdo_invocations = 0, mdo_backedges = 0;
       
    39   int mdo_invocations_start = 0, mdo_backedges_start = 0;
       
    40   if (mdh() != NULL) {
       
    41     mdo_invocations = mdh->invocation_count();
       
    42     mdo_backedges = mdh->backedge_count();
       
    43     mdo_invocations_start = mdh->invocation_count_start();
       
    44     mdo_backedges_start = mdh->backedge_count_start();
       
    45   }
       
    46   tty->print(" %stotal: %d,%d %smdo: %d(%d),%d(%d)", prefix,
       
    47       invocation_count, backedge_count, prefix,
       
    48       mdo_invocations, mdo_invocations_start,
       
    49       mdo_backedges, mdo_backedges_start);
       
    50   tty->print(" %smax levels: %d,%d", prefix,
       
    51       mh->highest_comp_level(), mh->highest_osr_comp_level());
       
    52 }
       
    53 
    33 // Print an event.
    54 // Print an event.
    34 void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodHandle imh,
    55 void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodHandle imh,
    35                                         int bci, CompLevel level) {
    56                                         int bci, CompLevel level) {
    36   bool inlinee_event = mh() != imh();
    57   bool inlinee_event = mh() != imh();
    37 
    58 
    38   ttyLocker tty_lock;
    59   ttyLocker tty_lock;
    39   tty->print("%lf: [", os::elapsedTime());
    60   tty->print("%lf: [", os::elapsedTime());
    40 
    61 
    41   int invocation_count = mh->invocation_count();
       
    42   int backedge_count = mh->backedge_count();
       
    43   switch(type) {
    62   switch(type) {
    44   case CALL:
    63   case CALL:
    45     tty->print("call");
    64     tty->print("call");
    46     break;
    65     break;
    47   case LOOP:
    66   case LOOP:
    80                                        CompileBroker::queue_size(CompLevel_full_optimization));
    99                                        CompileBroker::queue_size(CompLevel_full_optimization));
    81 
   100 
    82   print_specific(type, mh, imh, bci, level);
   101   print_specific(type, mh, imh, bci, level);
    83 
   102 
    84   if (type != COMPILE) {
   103   if (type != COMPILE) {
    85     methodDataHandle mdh = mh->method_data();
   104     print_counters("", mh);
    86     int mdo_invocations = 0, mdo_backedges = 0;
       
    87     int mdo_invocations_start = 0, mdo_backedges_start = 0;
       
    88     if (mdh() != NULL) {
       
    89       mdo_invocations = mdh->invocation_count();
       
    90       mdo_backedges = mdh->backedge_count();
       
    91       mdo_invocations_start = mdh->invocation_count_start();
       
    92       mdo_backedges_start = mdh->backedge_count_start();
       
    93     }
       
    94     tty->print(" total: %d,%d mdo: %d(%d),%d(%d)",
       
    95                invocation_count, backedge_count,
       
    96                mdo_invocations, mdo_invocations_start,
       
    97                mdo_backedges, mdo_backedges_start);
       
    98     tty->print(" max levels: %d,%d",
       
    99                 mh->highest_comp_level(), mh->highest_osr_comp_level());
       
   100     if (inlinee_event) {
   105     if (inlinee_event) {
   101       tty->print(" inlinee max levels: %d,%d", imh->highest_comp_level(), imh->highest_osr_comp_level());
   106       print_counters("inlinee ", imh);
   102     }
   107     }
   103     tty->print(" compilable: ");
   108     tty->print(" compilable: ");
   104     bool need_comma = false;
   109     bool need_comma = false;
   105     if (!mh->is_not_compilable(CompLevel_full_profile)) {
   110     if (!mh->is_not_compilable(CompLevel_full_profile)) {
   106       tty->print("c1");
   111       tty->print("c1");