< prev index next >

src/hotspot/share/runtime/perfData.hpp

Print this page
rev 55659 : 8225776: Branch profiling for G1's write post-barrier in C2.


  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 #ifndef SHARE_RUNTIME_PERFDATA_HPP
  26 #define SHARE_RUNTIME_PERFDATA_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/perfMemory.hpp"

  30 #include "runtime/timer.hpp"
  31 
  32 template <typename T> class GrowableArray;
  33 
  34 /* jvmstat global and subsystem counter name space - enumeration value
  35  * serve as an index into the PerfDataManager::_name_space[] array
  36  * containing the corresponding name space string. Only the top level
  37  * subsystem name spaces are represented here.
  38  */
  39 enum CounterNS {
  40   // top level name spaces
  41   JAVA_NS,
  42   COM_NS,
  43   SUN_NS,
  44   // subsystem name spaces
  45   JAVA_GC,              // Garbage Collection name spaces
  46   COM_GC,
  47   SUN_GC,
  48   JAVA_CI,              // Compiler name spaces
  49   COM_CI,


 409     jlong* _sampled;
 410     PerfLongSampleHelper* _sample_helper;
 411 
 412     PerfLongVariant(CounterNS ns, const char* namep, Units u, Variability v,
 413                     jlong initial_value=0)
 414                    : PerfLong(ns, namep, u, v) {
 415       if (is_valid()) *(jlong*)_valuep = initial_value;
 416     }
 417 
 418     PerfLongVariant(CounterNS ns, const char* namep, Units u, Variability v,
 419                     jlong* sampled);
 420 
 421     PerfLongVariant(CounterNS ns, const char* namep, Units u, Variability v,
 422                     PerfLongSampleHelper* sample_helper);
 423 
 424     void sample();
 425 
 426   public:
 427     inline void inc() { (*(jlong*)_valuep)++; }
 428     inline void inc(jlong val) { (*(jlong*)_valuep) += val; }

 429     inline void dec(jlong val) { inc(-val); }
 430     inline void add(jlong val) { (*(jlong*)_valuep) += val; }

 431     void clear_sample_helper() { _sample_helper = NULL; }
 432 };
 433 
 434 /*
 435  * The PerfLongCounter class, and its alias PerfCounter, implement
 436  * a PerfData subtype that holds a jlong data value that can (should)
 437  * be modified in a monotonic manner. The inc(jlong) and add(jlong)
 438  * methods can be passed negative values to implement a monotonically
 439  * decreasing value. However, we rely upon the programmer to honor
 440  * the notion that this counter always moves in the same direction -
 441  * either increasing or decreasing.
 442  */
 443 class PerfLongCounter : public PerfLongVariant {
 444 
 445   friend class PerfDataManager; // for access to protected constructor
 446 
 447   protected:
 448 
 449     PerfLongCounter(CounterNS ns, const char* namep, Units u,
 450                     jlong initial_value=0)




  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 #ifndef SHARE_RUNTIME_PERFDATA_HPP
  26 #define SHARE_RUNTIME_PERFDATA_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/perfMemory.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/timer.hpp"
  32 
  33 template <typename T> class GrowableArray;
  34 
  35 /* jvmstat global and subsystem counter name space - enumeration value
  36  * serve as an index into the PerfDataManager::_name_space[] array
  37  * containing the corresponding name space string. Only the top level
  38  * subsystem name spaces are represented here.
  39  */
  40 enum CounterNS {
  41   // top level name spaces
  42   JAVA_NS,
  43   COM_NS,
  44   SUN_NS,
  45   // subsystem name spaces
  46   JAVA_GC,              // Garbage Collection name spaces
  47   COM_GC,
  48   SUN_GC,
  49   JAVA_CI,              // Compiler name spaces
  50   COM_CI,


 410     jlong* _sampled;
 411     PerfLongSampleHelper* _sample_helper;
 412 
 413     PerfLongVariant(CounterNS ns, const char* namep, Units u, Variability v,
 414                     jlong initial_value=0)
 415                    : PerfLong(ns, namep, u, v) {
 416       if (is_valid()) *(jlong*)_valuep = initial_value;
 417     }
 418 
 419     PerfLongVariant(CounterNS ns, const char* namep, Units u, Variability v,
 420                     jlong* sampled);
 421 
 422     PerfLongVariant(CounterNS ns, const char* namep, Units u, Variability v,
 423                     PerfLongSampleHelper* sample_helper);
 424 
 425     void sample();
 426 
 427   public:
 428     inline void inc() { (*(jlong*)_valuep)++; }
 429     inline void inc(jlong val) { (*(jlong*)_valuep) += val; }
 430     inline void atomic_inc() { Atomic::inc((jlong*)_valuep); }
 431     inline void dec(jlong val) { inc(-val); }
 432     inline void add(jlong val) { (*(jlong*)_valuep) += val; }
 433     inline void atomic_add(jlong val) { Atomic::add(val, (jlong*)_valuep); }
 434     void clear_sample_helper() { _sample_helper = NULL; }
 435 };
 436 
 437 /*
 438  * The PerfLongCounter class, and its alias PerfCounter, implement
 439  * a PerfData subtype that holds a jlong data value that can (should)
 440  * be modified in a monotonic manner. The inc(jlong) and add(jlong)
 441  * methods can be passed negative values to implement a monotonically
 442  * decreasing value. However, we rely upon the programmer to honor
 443  * the notion that this counter always moves in the same direction -
 444  * either increasing or decreasing.
 445  */
 446 class PerfLongCounter : public PerfLongVariant {
 447 
 448   friend class PerfDataManager; // for access to protected constructor
 449 
 450   protected:
 451 
 452     PerfLongCounter(CounterNS ns, const char* namep, Units u,
 453                     jlong initial_value=0)


< prev index next >