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_INLINE_HPP
26 #define SHARE_VM_UTILITIES_TICKS_INLINE_HPP
27
28 #include "utilities/ticks.hpp"
29
30 inline Tickspan operator+(Tickspan lhs, const Tickspan& rhs) {
31 lhs += rhs;
32 return lhs;
33 }
34
35 inline bool operator==(const Tickspan& lhs, const Tickspan& rhs) {
36 return lhs.value() == rhs.value();
37 }
38
39 inline bool operator!=(const Tickspan& lhs, const Tickspan& rhs) {
40 return !operator==(lhs,rhs);
41 }
42
43 inline bool operator<(const Tickspan& lhs, const Tickspan& rhs) {
44 return lhs.value() < rhs.value();
45 }
46
47 inline bool operator>(const Tickspan& lhs, const Tickspan& rhs) {
48 return operator<(rhs,lhs);
49 }
50
51 inline bool operator<=(const Tickspan& lhs, const Tickspan& rhs) {
52 return !operator>(lhs,rhs);
53 }
54
55 inline bool operator>=(const Tickspan& lhs, const Tickspan& rhs) {
56 return !operator<(lhs,rhs);
57 }
58
59 inline Ticks operator+(Ticks lhs, const Tickspan& span) {
60 lhs += span;
61 return lhs;
62 }
63
64 inline Ticks operator-(Ticks lhs, const Tickspan& span) {
65 lhs -= span;
66 return lhs;
67 }
68
69 inline Tickspan operator-(const Ticks& end, const Ticks& start) {
70 return Tickspan(end, start);
71 }
72
73 inline bool operator==(const Ticks& lhs, const Ticks& rhs) {
74 return lhs.value() == rhs.value();
75 }
76
77 inline bool operator!=(const Ticks& lhs, const Ticks& rhs) {
78 return !operator==(lhs,rhs);
79 }
80
81 inline bool operator<(const Ticks& lhs, const Ticks& rhs) {
82 return lhs.value() < rhs.value();
83 }
84
85 inline bool operator>(const Ticks& lhs, const Ticks& rhs) {
86 return operator<(rhs,lhs);
87 }
88
89 inline bool operator<=(const Ticks& lhs, const Ticks& rhs) {
90 return !operator>(lhs,rhs);
91 }
92
93 inline bool operator>=(const Ticks& lhs, const Ticks& rhs) {
94 return !operator<(lhs,rhs);
95 }
96
97 #endif // SHARE_VM_UTILITIES_TICKS_INLINE_HPP
|
1 /*
2 * Copyright (c) 2013, 2018, 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_INLINE_HPP
26 #define SHARE_VM_UTILITIES_TICKS_INLINE_HPP
27
28 #include "utilities/ticks.hpp"
29
30 template <typename InstantType>
31 inline TimeInterval<InstantType>& TimeInterval<InstantType>::operator+=(const TimeInterval<InstantType>& rhs) {
32 _interval += rhs._interval;
33 return *this;
34 }
35
36 template <typename InstantType>
37 inline TimeInterval<InstantType>& TimeInterval<InstantType>::operator-=(const TimeInterval<InstantType>& rhs) {
38 _interval -= rhs._interval;
39 return *this;
40 }
41
42 template <typename InstantType>
43 inline bool operator==(const TimeInterval<InstantType>& lhs, const TimeInterval<InstantType>& rhs) {
44 return lhs.value() == rhs.value();
45 }
46
47 template <typename InstantType>
48 inline bool operator!=(const TimeInterval<InstantType>& lhs, const TimeInterval<InstantType>& rhs) {
49 return !operator==(lhs, rhs);
50 }
51
52 template <typename InstantType>
53 inline bool operator<(const TimeInterval<InstantType>& lhs, const TimeInterval<InstantType>& rhs) {
54 return lhs.value() < rhs.value();
55 }
56
57 template <typename InstantType>
58 inline bool operator>(const TimeInterval<InstantType>& lhs, const TimeInterval<InstantType>& rhs) {
59 return operator<(rhs, lhs);
60 }
61
62 template <typename InstantType>
63 inline bool operator<=(const TimeInterval<InstantType>& lhs, const TimeInterval<InstantType>& rhs) {
64 return !operator>(lhs, rhs);
65 }
66
67 template <typename InstantType>
68 inline bool operator>=(const TimeInterval<InstantType>& lhs, const TimeInterval<InstantType>& rhs) {
69 return !operator<(lhs, rhs);
70 }
71
72 template <typename InstantType>
73 inline TimeInterval<InstantType> operator-(const InstantType& end, const InstantType& start) {
74 return TimeInterval<InstantType>(end, start);
75 }
76
77 inline TimeInstant& TimeInstant::operator+=(const TimeInterval<TimeInstant>& rhs) {
78 _instant += rhs.value();
79 return *this;
80 }
81
82 inline TimeInstant& TimeInstant::operator-=(const TimeInterval<TimeInstant>& rhs) {
83 _instant -= rhs.value();
84 return *this;
85 }
86
87 inline bool operator==(const TimeInstant& lhs, const TimeInstant& rhs) {
88 return lhs.value() == rhs.value();
89 }
90
91 inline bool operator!=(const TimeInstant& lhs, const TimeInstant& rhs) {
92 return !operator==(lhs, rhs);
93 }
94
95 inline bool operator<(const TimeInstant& lhs, const TimeInstant& rhs) {
96 return lhs.value() < rhs.value();
97 }
98
99 inline bool operator>(const TimeInstant& lhs, const TimeInstant& rhs) {
100 return operator<(rhs, lhs);
101 }
102
103 inline bool operator<=(const TimeInstant& lhs, const TimeInstant& rhs) {
104 return !operator>(lhs, rhs);
105 }
106
107 inline bool operator>=(const TimeInstant& lhs, const TimeInstant& rhs) {
108 return !operator<(lhs, rhs);
109 }
110
111 inline TimeInstant operator+(const TimeInstant& lhs, const TimeInterval<TimeInstant>& span) {
112 TimeInstant t(lhs);
113 t += span;
114 return t;
115 }
116
117 inline TimeInstant operator-(const TimeInstant& lhs, const TimeInterval<TimeInstant>& span) {
118 TimeInstant t(lhs);
119 t -= span;
120 return t;
121 }
122
123 // TraceElapsedInterval
124
125 inline bool operator==(const TraceElapsedInterval& lhs, const TraceElapsedInterval& rhs) {
126 return lhs.value() == rhs.value();
127 }
128
129 inline bool operator!=(const TraceElapsedInterval& lhs, const TraceElapsedInterval& rhs) {
130 return !operator==(lhs, rhs);
131 }
132
133 inline bool operator<(const TraceElapsedInterval& lhs, const TraceElapsedInterval& rhs) {
134 return lhs.value() < rhs.value();
135 }
136
137 inline bool operator>(const TraceElapsedInterval& lhs, const TraceElapsedInterval& rhs) {
138 return operator<(rhs, lhs);
139 }
140
141 inline bool operator<=(const TraceElapsedInterval& lhs, const TraceElapsedInterval& rhs) {
142 return !operator>(lhs, rhs);
143 }
144
145 inline bool operator>=(const TraceElapsedInterval& lhs, const TraceElapsedInterval& rhs) {
146 return !operator<(lhs, rhs);
147 }
148
149 inline TraceElapsedInterval operator-(const TraceElapsedCounter& end, const TraceElapsedCounter& start) {
150 return TraceElapsedInterval(end, start);
151 }
152
153 // TraceElapsedCounter
154
155 inline TraceElapsedCounter operator+(const TraceElapsedCounter& lhs, const TraceElapsedInterval& span) {
156 TraceElapsedCounter t(lhs);
157 t += span;
158 return t;
159 }
160
161 inline TraceElapsedCounter operator-(const TraceElapsedCounter& lhs, const TraceElapsedInterval& span) {
162 TraceElapsedCounter t(lhs);
163 t -= span;
164 return t;
165 }
166
167 inline bool operator==(const TraceElapsedCounter& lhs, const TraceElapsedCounter& rhs) {
168 return lhs.value() == rhs.value();
169 }
170
171 inline bool operator!=(const TraceElapsedCounter& lhs, const TraceElapsedCounter& rhs) {
172 return !operator==(lhs, rhs);
173 }
174
175 inline bool operator<(const TraceElapsedCounter& lhs, const TraceElapsedCounter& rhs) {
176 return lhs.value() < rhs.value();
177 }
178
179 inline bool operator>(const TraceElapsedCounter& lhs, const TraceElapsedCounter& rhs) {
180 return operator<(rhs, lhs);
181 }
182
183 inline bool operator<=(const TraceElapsedCounter& lhs, const TraceElapsedCounter& rhs) {
184 return !operator>(lhs, rhs);
185 }
186
187 inline bool operator>=(const TraceElapsedCounter& lhs, const TraceElapsedCounter& rhs) {
188 return !operator<(lhs, rhs);
189 }
190
191 #endif // SHARE_VM_UTILITIES_TICKS_INLINE_HPP
|