annotate hotspot/src/share/vm/utilities/ticks.hpp @ 46545:b970b6e40209

8181450: assert in BasicHashtable::verify_table Summary: remove assert as it has small probability of happening and added logging Reviewed-by: kbarrett, sspitsyn
author coleenp
date Fri, 16 Jun 2017 09:13:56 -0400
parents
children
rev   line source
mgronlun@21767 1 /*
mgronlun@21767 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
mgronlun@21767 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mgronlun@21767 4 *
mgronlun@21767 5 * This code is free software; you can redistribute it and/or modify it
mgronlun@21767 6 * under the terms of the GNU General Public License version 2 only, as
mgronlun@21767 7 * published by the Free Software Foundation.
mgronlun@21767 8 *
mgronlun@21767 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mgronlun@21767 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mgronlun@21767 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mgronlun@21767 12 * version 2 for more details (a copy is included in the LICENSE file that
mgronlun@21767 13 * accompanied this code).
mgronlun@21767 14 *
mgronlun@21767 15 * You should have received a copy of the GNU General Public License version
mgronlun@21767 16 * 2 along with this work; if not, write to the Free Software Foundation,
mgronlun@21767 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mgronlun@21767 18 *
mgronlun@21767 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mgronlun@21767 20 * or visit www.oracle.com if you need additional information or have any
mgronlun@21767 21 * questions.
mgronlun@21767 22 *
mgronlun@21767 23 */
mgronlun@21767 24
mgronlun@21767 25 #ifndef SHARE_VM_UTILITIES_TICKS_HPP
mgronlun@21767 26 #define SHARE_VM_UTILITIES_TICKS_HPP
mgronlun@21767 27
mgronlun@21767 28 #include "memory/allocation.hpp"
mgronlun@21767 29 #include "utilities/globalDefinitions.hpp"
mgronlun@21767 30
mgronlun@21767 31 class Ticks;
mgronlun@21767 32
mgronlun@21767 33 class Tickspan VALUE_OBJ_CLASS_SPEC {
mgronlun@21767 34 friend class Ticks;
mgronlun@21767 35 friend Tickspan operator-(const Ticks& end, const Ticks& start);
mgronlun@21767 36
mgronlun@21767 37 private:
mgronlun@21767 38 jlong _span_ticks;
mgronlun@21767 39
mgronlun@21767 40 Tickspan(const Ticks& end, const Ticks& start);
mgronlun@21767 41
mgronlun@21767 42 public:
mgronlun@21767 43 Tickspan() : _span_ticks(0) {}
mgronlun@21767 44
mgronlun@21767 45 Tickspan& operator+=(const Tickspan& rhs) {
mgronlun@21767 46 _span_ticks += rhs._span_ticks;
mgronlun@21767 47 return *this;
mgronlun@21767 48 }
mgronlun@21767 49
mgronlun@21767 50 jlong value() const {
mgronlun@21767 51 return _span_ticks;
mgronlun@21767 52 }
mgronlun@21767 53
mgronlun@21767 54 };
mgronlun@21767 55
mgronlun@21767 56 class Ticks VALUE_OBJ_CLASS_SPEC {
mgronlun@21767 57 private:
mgronlun@21767 58 jlong _stamp_ticks;
mgronlun@21767 59
mgronlun@21767 60 public:
mgronlun@21767 61 Ticks() : _stamp_ticks(0) {
mgronlun@21767 62 assert((_stamp_ticks = invalid_time_stamp) == invalid_time_stamp,
mgronlun@21767 63 "initial unstamped time value assignment");
mgronlun@21767 64 }
mgronlun@21767 65
mgronlun@21767 66 Ticks& operator+=(const Tickspan& span) {
mgronlun@21767 67 _stamp_ticks += span.value();
mgronlun@21767 68 return *this;
mgronlun@21767 69 }
mgronlun@21767 70
mgronlun@21767 71 Ticks& operator-=(const Tickspan& span) {
mgronlun@21767 72 _stamp_ticks -= span.value();
mgronlun@21767 73 return *this;
mgronlun@21767 74 }
mgronlun@21767 75
mgronlun@21767 76 void stamp();
mgronlun@21767 77
mgronlun@21767 78 jlong value() const {
mgronlun@21767 79 return _stamp_ticks;
mgronlun@21767 80 }
mgronlun@21767 81
mgronlun@21767 82 static const Ticks now();
mgronlun@21767 83
mgronlun@21767 84 #ifdef ASSERT
mgronlun@21767 85 static const jlong invalid_time_stamp;
mgronlun@21767 86 #endif
mgronlun@21767 87
mgronlun@21767 88 #ifndef PRODUCT
mgronlun@21767 89 // only for internal use by GC VM tests
mgronlun@21767 90 friend class TimePartitionPhasesIteratorTest;
mgronlun@21767 91 friend class GCTimerTest;
mgronlun@21767 92
mgronlun@21767 93 private:
mgronlun@21767 94 // implicit type conversion
mgronlun@21767 95 Ticks(int ticks) : _stamp_ticks(ticks) {}
mgronlun@21767 96
mgronlun@21767 97 #endif // !PRODUCT
mgronlun@21767 98
mgronlun@21767 99 };
mgronlun@21767 100
mgronlun@21767 101 class TicksToTimeHelper : public AllStatic {
mgronlun@21767 102 public:
mgronlun@21767 103 enum Unit {
mgronlun@21767 104 SECONDS = 1,
mgronlun@21767 105 MILLISECONDS = 1000
mgronlun@21767 106 };
mgronlun@21767 107 static double seconds(const Tickspan& span);
mgronlun@21767 108 static jlong milliseconds(const Tickspan& span);
mgronlun@21767 109 };
mgronlun@21767 110
mgronlun@21767 111 #endif // SHARE_VM_UTILITIES_TICKS_HPP