src/share/vm/utilities/ticks.hpp

Tue, 19 Aug 2014 08:34:25 -0400

author
zgu
date
Tue, 19 Aug 2014 08:34:25 -0400
changeset 7078
c6211b707068
parent 0
f90c822e73f8
child 9858
b985cbb00e68
permissions
-rw-r--r--

8055007: NMT2: emptyStack missing in minimal build
Summary: Refactored emptyStack to a static member of NativeCallStack, which is accessible in minimal build.
Reviewed-by: coleenp, dholmes

     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     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  */
    25 #ifndef SHARE_VM_UTILITIES_TICKS_HPP
    26 #define SHARE_VM_UTILITIES_TICKS_HPP
    28 #include "memory/allocation.hpp"
    29 #include "utilities/globalDefinitions.hpp"
    31 class Ticks;
    33 class Tickspan VALUE_OBJ_CLASS_SPEC {
    34   friend class Ticks;
    35   friend Tickspan operator-(const Ticks& end, const Ticks& start);
    37  private:
    38   jlong _span_ticks;
    40   Tickspan(const Ticks& end, const Ticks& start);
    42  public:
    43   Tickspan() : _span_ticks(0) {}
    45   Tickspan& operator+=(const Tickspan& rhs) {
    46     _span_ticks += rhs._span_ticks;
    47     return *this;
    48   }
    50   jlong value() const {
    51     return _span_ticks;
    52   }
    54 };
    56 class Ticks VALUE_OBJ_CLASS_SPEC {
    57  private:
    58   jlong _stamp_ticks;
    60  public:
    61   Ticks() : _stamp_ticks(0) {
    62     assert((_stamp_ticks = invalid_time_stamp) == invalid_time_stamp,
    63       "initial unstamped time value assignment");
    64   }
    66   Ticks& operator+=(const Tickspan& span) {
    67     _stamp_ticks += span.value();
    68     return *this;
    69   }
    71   Ticks& operator-=(const Tickspan& span) {
    72     _stamp_ticks -= span.value();
    73     return *this;
    74   }
    76   void stamp();
    78   jlong value() const {
    79     return _stamp_ticks;
    80   }
    82   static const Ticks now();
    84 #ifdef ASSERT
    85   static const jlong invalid_time_stamp;
    86 #endif
    88 #ifndef PRODUCT
    89   // only for internal use by GC VM tests
    90   friend class TimePartitionPhasesIteratorTest;
    91   friend class GCTimerTest;
    93  private:
    94   // implicit type conversion
    95   Ticks(int ticks) : _stamp_ticks(ticks) {}
    97 #endif // !PRODUCT
    99 };
   101 class TicksToTimeHelper : public AllStatic {
   102  public:
   103   enum Unit {
   104     SECONDS = 1,
   105     MILLISECONDS = 1000
   106   };
   107   static double seconds(const Tickspan& span);
   108   static jlong milliseconds(const Tickspan& span);
   109 };
   111 #endif // SHARE_VM_UTILITIES_TICKS_HPP

mercurial