comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:1e1407cafa92
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 */
24
25 #ifndef SHARE_VM_UTILITIES_TICKS_HPP
26 #define SHARE_VM_UTILITIES_TICKS_HPP
27
28 #include "memory/allocation.hpp"
29 #include "utilities/globalDefinitions.hpp"
30
31 class Ticks;
32
33 class Tickspan VALUE_OBJ_CLASS_SPEC {
34 friend class Ticks;
35 friend Tickspan operator-(const Ticks& end, const Ticks& start);
36
37 private:
38 jlong _span_ticks;
39
40 Tickspan(const Ticks& end, const Ticks& start);
41
42 public:
43 Tickspan() : _span_ticks(0) {}
44
45 Tickspan& operator+=(const Tickspan& rhs) {
46 _span_ticks += rhs._span_ticks;
47 return *this;
48 }
49
50 jlong value() const {
51 return _span_ticks;
52 }
53
54 };
55
56 class Ticks VALUE_OBJ_CLASS_SPEC {
57 private:
58 jlong _stamp_ticks;
59
60 public:
61 Ticks() : _stamp_ticks(0) {
62 assert((_stamp_ticks = invalid_time_stamp) == invalid_time_stamp,
63 "initial unstamped time value assignment");
64 }
65
66 Ticks& operator+=(const Tickspan& span) {
67 _stamp_ticks += span.value();
68 return *this;
69 }
70
71 Ticks& operator-=(const Tickspan& span) {
72 _stamp_ticks -= span.value();
73 return *this;
74 }
75
76 void stamp();
77
78 jlong value() const {
79 return _stamp_ticks;
80 }
81
82 static const Ticks now();
83
84 #ifdef ASSERT
85 static const jlong invalid_time_stamp;
86 #endif
87
88 #ifndef PRODUCT
89 // only for internal use by GC VM tests
90 friend class TimePartitionPhasesIteratorTest;
91 friend class GCTimerTest;
92
93 private:
94 // implicit type conversion
95 Ticks(int ticks) : _stamp_ticks(ticks) {}
96
97 #endif // !PRODUCT
98
99 };
100
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 };
110
111 #endif // SHARE_VM_UTILITIES_TICKS_HPP