src/share/vm/gc_implementation/g1/g1StringDedupStat.hpp

changeset 6413
595c0f60d50d
parent 0
f90c822e73f8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1StringDedupStat.hpp	Tue Mar 18 19:07:22 2014 +0100
     1.3 @@ -0,0 +1,142 @@
     1.4 +/*
     1.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPSTAT_HPP
    1.29 +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPSTAT_HPP
    1.30 +
    1.31 +#include "memory/allocation.hpp"
    1.32 +#include "runtime/os.hpp"
    1.33 +
    1.34 +// Macros for GC log output formating
    1.35 +#define G1_STRDEDUP_OBJECTS_FORMAT         UINTX_FORMAT_W(12)
    1.36 +#define G1_STRDEDUP_TIME_FORMAT            "%1.7lf secs"
    1.37 +#define G1_STRDEDUP_PERCENT_FORMAT         "%5.1lf%%"
    1.38 +#define G1_STRDEDUP_PERCENT_FORMAT_NS      "%.1lf%%"
    1.39 +#define G1_STRDEDUP_BYTES_FORMAT           "%8.1lf%s"
    1.40 +#define G1_STRDEDUP_BYTES_FORMAT_NS        "%.1lf%s"
    1.41 +#define G1_STRDEDUP_BYTES_PARAM(bytes)     byte_size_in_proper_unit((double)(bytes)), proper_unit_for_byte_size((bytes))
    1.42 +
    1.43 +//
    1.44 +// Statistics gathered by the deduplication thread.
    1.45 +//
    1.46 +class G1StringDedupStat : public StackObj {
    1.47 +private:
    1.48 +  // Counters
    1.49 +  uintx  _inspected;
    1.50 +  uintx  _skipped;
    1.51 +  uintx  _hashed;
    1.52 +  uintx  _known;
    1.53 +  uintx  _new;
    1.54 +  uintx  _new_bytes;
    1.55 +  uintx  _deduped;
    1.56 +  uintx  _deduped_bytes;
    1.57 +  uintx  _deduped_young;
    1.58 +  uintx  _deduped_young_bytes;
    1.59 +  uintx  _deduped_old;
    1.60 +  uintx  _deduped_old_bytes;
    1.61 +  uintx  _idle;
    1.62 +  uintx  _exec;
    1.63 +  uintx  _block;
    1.64 +
    1.65 +  // Time spent by the deduplication thread in different phases
    1.66 +  double _start;
    1.67 +  double _idle_elapsed;
    1.68 +  double _exec_elapsed;
    1.69 +  double _block_elapsed;
    1.70 +
    1.71 +public:
    1.72 +  G1StringDedupStat();
    1.73 +
    1.74 +  void inc_inspected() {
    1.75 +    _inspected++;
    1.76 +  }
    1.77 +
    1.78 +  void inc_skipped() {
    1.79 +    _skipped++;
    1.80 +  }
    1.81 +
    1.82 +  void inc_hashed() {
    1.83 +    _hashed++;
    1.84 +  }
    1.85 +
    1.86 +  void inc_known() {
    1.87 +    _known++;
    1.88 +  }
    1.89 +
    1.90 +  void inc_new(uintx bytes) {
    1.91 +    _new++;
    1.92 +    _new_bytes += bytes;
    1.93 +  }
    1.94 +
    1.95 +  void inc_deduped_young(uintx bytes) {
    1.96 +    _deduped++;
    1.97 +    _deduped_bytes += bytes;
    1.98 +    _deduped_young++;
    1.99 +    _deduped_young_bytes += bytes;
   1.100 +  }
   1.101 +
   1.102 +  void inc_deduped_old(uintx bytes) {
   1.103 +    _deduped++;
   1.104 +    _deduped_bytes += bytes;
   1.105 +    _deduped_old++;
   1.106 +    _deduped_old_bytes += bytes;
   1.107 +  }
   1.108 +
   1.109 +  void mark_idle() {
   1.110 +    _start = os::elapsedTime();
   1.111 +    _idle++;
   1.112 +  }
   1.113 +
   1.114 +  void mark_exec() {
   1.115 +    double now = os::elapsedTime();
   1.116 +    _idle_elapsed = now - _start;
   1.117 +    _start = now;
   1.118 +    _exec++;
   1.119 +  }
   1.120 +
   1.121 +  void mark_block() {
   1.122 +    double now = os::elapsedTime();
   1.123 +    _exec_elapsed += now - _start;
   1.124 +    _start = now;
   1.125 +    _block++;
   1.126 +  }
   1.127 +
   1.128 +  void mark_unblock() {
   1.129 +    double now = os::elapsedTime();
   1.130 +    _block_elapsed += now - _start;
   1.131 +    _start = now;
   1.132 +  }
   1.133 +
   1.134 +  void mark_done() {
   1.135 +    double now = os::elapsedTime();
   1.136 +    _exec_elapsed += now - _start;
   1.137 +  }
   1.138 +
   1.139 +  void add(const G1StringDedupStat& stat);
   1.140 +
   1.141 +  static void print_summary(outputStream* st, const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat);
   1.142 +  static void print_statistics(outputStream* st, const G1StringDedupStat& stat, bool total);
   1.143 +};
   1.144 +
   1.145 +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPSTAT_HPP

mercurial