< prev index next >

src/share/vm/gc/g1/g1StringDedupStat.cpp

Print this page




   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 "gc/g1/g1StringDedupStat.hpp"

  27 
  28 G1StringDedupStat::G1StringDedupStat() :
  29   _inspected(0),
  30   _skipped(0),
  31   _hashed(0),
  32   _known(0),
  33   _new(0),
  34   _new_bytes(0),
  35   _deduped(0),
  36   _deduped_bytes(0),
  37   _deduped_young(0),
  38   _deduped_young_bytes(0),
  39   _deduped_old(0),
  40   _deduped_old_bytes(0),
  41   _idle(0),
  42   _exec(0),
  43   _block(0),
  44   _start(0.0),
  45   _idle_elapsed(0.0),
  46   _exec_elapsed(0.0),


  51   _inspected           += stat._inspected;
  52   _skipped             += stat._skipped;
  53   _hashed              += stat._hashed;
  54   _known               += stat._known;
  55   _new                 += stat._new;
  56   _new_bytes           += stat._new_bytes;
  57   _deduped             += stat._deduped;
  58   _deduped_bytes       += stat._deduped_bytes;
  59   _deduped_young       += stat._deduped_young;
  60   _deduped_young_bytes += stat._deduped_young_bytes;
  61   _deduped_old         += stat._deduped_old;
  62   _deduped_old_bytes   += stat._deduped_old_bytes;
  63   _idle                += stat._idle;
  64   _exec                += stat._exec;
  65   _block               += stat._block;
  66   _idle_elapsed        += stat._idle_elapsed;
  67   _exec_elapsed        += stat._exec_elapsed;
  68   _block_elapsed       += stat._block_elapsed;
  69 }
  70 
  71 void G1StringDedupStat::print_summary(outputStream* st, const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat) {
  72   double total_deduped_bytes_percent = 0.0;
  73 
  74   if (total_stat._new_bytes > 0) {
  75     // Avoid division by zero
  76     total_deduped_bytes_percent = (double)total_stat._deduped_bytes / (double)total_stat._new_bytes * 100.0;
  77   }
  78 
  79   st->date_stamp(PrintGCDateStamps);
  80   st->stamp(PrintGCTimeStamps);
  81   st->print_cr(
  82     "[GC concurrent-string-deduplication, "
  83     G1_STRDEDUP_BYTES_FORMAT_NS "->" G1_STRDEDUP_BYTES_FORMAT_NS "(" G1_STRDEDUP_BYTES_FORMAT_NS "), avg "
  84     G1_STRDEDUP_PERCENT_FORMAT_NS ", " G1_STRDEDUP_TIME_FORMAT "]",
  85     G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes),
  86     G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes - last_stat._deduped_bytes),
  87     G1_STRDEDUP_BYTES_PARAM(last_stat._deduped_bytes),
  88     total_deduped_bytes_percent,
  89     last_stat._exec_elapsed);
  90 }
  91 
  92 void G1StringDedupStat::print_statistics(outputStream* st, const G1StringDedupStat& stat, bool total) {
  93   double young_percent               = 0.0;
  94   double old_percent                 = 0.0;
  95   double skipped_percent             = 0.0;
  96   double hashed_percent              = 0.0;
  97   double known_percent               = 0.0;
  98   double new_percent                 = 0.0;
  99   double deduped_percent             = 0.0;
 100   double deduped_bytes_percent       = 0.0;
 101   double deduped_young_percent       = 0.0;
 102   double deduped_young_bytes_percent = 0.0;
 103   double deduped_old_percent         = 0.0;
 104   double deduped_old_bytes_percent   = 0.0;
 105 
 106   if (stat._inspected > 0) {
 107     // Avoid division by zero
 108     skipped_percent = (double)stat._skipped / (double)stat._inspected * 100.0;
 109     hashed_percent  = (double)stat._hashed / (double)stat._inspected * 100.0;
 110     known_percent   = (double)stat._known / (double)stat._inspected * 100.0;
 111     new_percent     = (double)stat._new / (double)stat._inspected * 100.0;
 112   }


 117   }
 118 
 119   if (stat._deduped > 0) {
 120     // Avoid division by zero
 121     deduped_young_percent = (double)stat._deduped_young / (double)stat._deduped * 100.0;
 122     deduped_old_percent   = (double)stat._deduped_old / (double)stat._deduped * 100.0;
 123   }
 124 
 125   if (stat._new_bytes > 0) {
 126     // Avoid division by zero
 127     deduped_bytes_percent = (double)stat._deduped_bytes / (double)stat._new_bytes * 100.0;
 128   }
 129 
 130   if (stat._deduped_bytes > 0) {
 131     // Avoid division by zero
 132     deduped_young_bytes_percent = (double)stat._deduped_young_bytes / (double)stat._deduped_bytes * 100.0;
 133     deduped_old_bytes_percent   = (double)stat._deduped_old_bytes / (double)stat._deduped_bytes * 100.0;
 134   }
 135 
 136   if (total) {
 137     st->print_cr(
 138       "   [Total Exec: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT ", Idle: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT ", Blocked: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT "]",
 139       stat._exec, stat._exec_elapsed, stat._idle, stat._idle_elapsed, stat._block, stat._block_elapsed);
 140   } else {
 141     st->print_cr(
 142       "   [Last Exec: " G1_STRDEDUP_TIME_FORMAT ", Idle: " G1_STRDEDUP_TIME_FORMAT ", Blocked: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT "]",
 143       stat._exec_elapsed, stat._idle_elapsed, stat._block, stat._block_elapsed);
 144   }
 145   st->print_cr(
 146     "      [Inspected:    " G1_STRDEDUP_OBJECTS_FORMAT "]\n"
 147     "         [Skipped:   " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]\n"
 148     "         [Hashed:    " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]\n"
 149     "         [Known:     " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]\n"
 150     "         [New:       " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "]\n"
 151     "      [Deduplicated: " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]\n"
 152     "         [Young:     " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]\n"
 153     "         [Old:       " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]",
 154     stat._inspected,
 155     stat._skipped, skipped_percent,
 156     stat._hashed, hashed_percent,
 157     stat._known, known_percent,
 158     stat._new, new_percent, G1_STRDEDUP_BYTES_PARAM(stat._new_bytes),
 159     stat._deduped, deduped_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_bytes), deduped_bytes_percent,
 160     stat._deduped_young, deduped_young_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_young_bytes), deduped_young_bytes_percent,
 161     stat._deduped_old, deduped_old_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_old_bytes), deduped_old_bytes_percent);
 162 }


   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 "gc/g1/g1StringDedupStat.hpp"
  27 #include "logging/log.hpp"
  28 
  29 G1StringDedupStat::G1StringDedupStat() :
  30   _inspected(0),
  31   _skipped(0),
  32   _hashed(0),
  33   _known(0),
  34   _new(0),
  35   _new_bytes(0),
  36   _deduped(0),
  37   _deduped_bytes(0),
  38   _deduped_young(0),
  39   _deduped_young_bytes(0),
  40   _deduped_old(0),
  41   _deduped_old_bytes(0),
  42   _idle(0),
  43   _exec(0),
  44   _block(0),
  45   _start(0.0),
  46   _idle_elapsed(0.0),
  47   _exec_elapsed(0.0),


  52   _inspected           += stat._inspected;
  53   _skipped             += stat._skipped;
  54   _hashed              += stat._hashed;
  55   _known               += stat._known;
  56   _new                 += stat._new;
  57   _new_bytes           += stat._new_bytes;
  58   _deduped             += stat._deduped;
  59   _deduped_bytes       += stat._deduped_bytes;
  60   _deduped_young       += stat._deduped_young;
  61   _deduped_young_bytes += stat._deduped_young_bytes;
  62   _deduped_old         += stat._deduped_old;
  63   _deduped_old_bytes   += stat._deduped_old_bytes;
  64   _idle                += stat._idle;
  65   _exec                += stat._exec;
  66   _block               += stat._block;
  67   _idle_elapsed        += stat._idle_elapsed;
  68   _exec_elapsed        += stat._exec_elapsed;
  69   _block_elapsed       += stat._block_elapsed;
  70 }
  71 
  72 void G1StringDedupStat::print_summary(const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat) {
  73   double total_deduped_bytes_percent = 0.0;
  74 
  75   if (total_stat._new_bytes > 0) {
  76     // Avoid division by zero
  77     total_deduped_bytes_percent = (double)total_stat._deduped_bytes / (double)total_stat._new_bytes * 100.0;
  78   }
  79 
  80   log_info(gc, stringdedup)(
  81     "Concurrent String Deduplication "


  82     G1_STRDEDUP_BYTES_FORMAT_NS "->" G1_STRDEDUP_BYTES_FORMAT_NS "(" G1_STRDEDUP_BYTES_FORMAT_NS "), avg "
  83     G1_STRDEDUP_PERCENT_FORMAT_NS ", " G1_STRDEDUP_TIME_FORMAT "]",
  84     G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes),
  85     G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes - last_stat._deduped_bytes),
  86     G1_STRDEDUP_BYTES_PARAM(last_stat._deduped_bytes),
  87     total_deduped_bytes_percent,
  88     last_stat._exec_elapsed);
  89 }
  90 
  91 void G1StringDedupStat::print_statistics(const G1StringDedupStat& stat, bool total) {
  92   double young_percent               = 0.0;
  93   double old_percent                 = 0.0;
  94   double skipped_percent             = 0.0;
  95   double hashed_percent              = 0.0;
  96   double known_percent               = 0.0;
  97   double new_percent                 = 0.0;
  98   double deduped_percent             = 0.0;
  99   double deduped_bytes_percent       = 0.0;
 100   double deduped_young_percent       = 0.0;
 101   double deduped_young_bytes_percent = 0.0;
 102   double deduped_old_percent         = 0.0;
 103   double deduped_old_bytes_percent   = 0.0;
 104 
 105   if (stat._inspected > 0) {
 106     // Avoid division by zero
 107     skipped_percent = (double)stat._skipped / (double)stat._inspected * 100.0;
 108     hashed_percent  = (double)stat._hashed / (double)stat._inspected * 100.0;
 109     known_percent   = (double)stat._known / (double)stat._inspected * 100.0;
 110     new_percent     = (double)stat._new / (double)stat._inspected * 100.0;
 111   }


 116   }
 117 
 118   if (stat._deduped > 0) {
 119     // Avoid division by zero
 120     deduped_young_percent = (double)stat._deduped_young / (double)stat._deduped * 100.0;
 121     deduped_old_percent   = (double)stat._deduped_old / (double)stat._deduped * 100.0;
 122   }
 123 
 124   if (stat._new_bytes > 0) {
 125     // Avoid division by zero
 126     deduped_bytes_percent = (double)stat._deduped_bytes / (double)stat._new_bytes * 100.0;
 127   }
 128 
 129   if (stat._deduped_bytes > 0) {
 130     // Avoid division by zero
 131     deduped_young_bytes_percent = (double)stat._deduped_young_bytes / (double)stat._deduped_bytes * 100.0;
 132     deduped_old_bytes_percent   = (double)stat._deduped_old_bytes / (double)stat._deduped_bytes * 100.0;
 133   }
 134 
 135   if (total) {
 136     log_debug(gc, stringdedup)(
 137       "   [Total Exec: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT ", Idle: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT ", Blocked: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT "]",
 138       stat._exec, stat._exec_elapsed, stat._idle, stat._idle_elapsed, stat._block, stat._block_elapsed);
 139   } else {
 140     log_debug(gc, stringdedup)(
 141       "   [Last Exec: " G1_STRDEDUP_TIME_FORMAT ", Idle: " G1_STRDEDUP_TIME_FORMAT ", Blocked: " UINTX_FORMAT "/" G1_STRDEDUP_TIME_FORMAT "]",
 142       stat._exec_elapsed, stat._idle_elapsed, stat._block, stat._block_elapsed);
 143   }
 144   log_debug(gc, stringdedup)("      [Inspected:    " G1_STRDEDUP_OBJECTS_FORMAT "]", stat._inspected);
 145   log_debug(gc, stringdedup)("         [Skipped:   " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]", stat._skipped, skipped_percent);
 146   log_debug(gc, stringdedup)("         [Hashed:    " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]", stat._hashed, hashed_percent);
 147   log_debug(gc, stringdedup)("         [Known:     " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]", stat._known, known_percent);
 148   log_debug(gc, stringdedup)("         [New:       " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "]",
 149                              stat._new, new_percent, G1_STRDEDUP_BYTES_PARAM(stat._new_bytes));
 150   log_debug(gc, stringdedup)("      [Deduplicated: " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]",
 151                              stat._deduped, deduped_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_bytes), deduped_bytes_percent);
 152   log_debug(gc, stringdedup)("         [Young:     " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]",
 153                              stat._deduped_young, deduped_young_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_young_bytes), deduped_young_bytes_percent);
 154   log_debug(gc, stringdedup)("         [Old:       " G1_STRDEDUP_OBJECTS_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ") " G1_STRDEDUP_BYTES_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT ")]",





 155                              stat._deduped_old, deduped_old_percent, G1_STRDEDUP_BYTES_PARAM(stat._deduped_old_bytes), deduped_old_bytes_percent);
 156 }
< prev index next >