hotspot/src/share/vm/utilities/ticks.inline.hpp
author ppunegov
Wed, 17 Aug 2016 18:48:34 +0300
changeset 41335 27115e2e42cc
parent 21767 41eaa9a17059
permissions -rw-r--r--
8156852: Convert JSON_test to Gtest Summary: convert test from InternalVMTests to Gtest Reviewed-by: kvn, kzhaldyb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     1
/*
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     4
 *
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     8
 *
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    13
 * accompanied this code).
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    14
 *
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    18
 *
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    21
 * questions.
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    22
 *
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    23
 */
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    24
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    25
#ifndef SHARE_VM_UTILITIES_TICKS_INLINE_HPP
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    26
#define SHARE_VM_UTILITIES_TICKS_INLINE_HPP
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    27
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    28
#include "utilities/ticks.hpp"
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    29
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    30
inline Tickspan operator+(Tickspan lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    31
  lhs += rhs;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    32
  return lhs;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    33
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    34
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    35
inline bool operator==(const Tickspan& lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    36
  return lhs.value() == rhs.value();
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    37
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    38
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    39
inline bool operator!=(const Tickspan& lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    40
  return !operator==(lhs,rhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    41
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    42
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    43
inline bool operator<(const Tickspan& lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    44
  return lhs.value() < rhs.value();
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    45
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    46
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    47
inline bool operator>(const Tickspan& lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    48
  return operator<(rhs,lhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    49
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    50
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    51
inline bool operator<=(const Tickspan& lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    52
  return !operator>(lhs,rhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    53
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    54
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    55
inline bool operator>=(const Tickspan& lhs, const Tickspan& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    56
  return !operator<(lhs,rhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    57
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    58
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    59
inline Ticks operator+(Ticks lhs, const Tickspan& span) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    60
  lhs += span;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    61
  return lhs;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    62
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    63
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    64
inline Ticks operator-(Ticks lhs, const Tickspan& span) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    65
  lhs -= span;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    66
  return lhs;
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    67
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    68
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    69
inline Tickspan operator-(const Ticks& end, const Ticks& start) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    70
  return Tickspan(end, start);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    71
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    72
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    73
inline bool operator==(const Ticks& lhs, const Ticks& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    74
  return lhs.value() == rhs.value();
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    75
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    76
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    77
inline bool operator!=(const Ticks& lhs, const Ticks& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    78
  return !operator==(lhs,rhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    79
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    80
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    81
inline bool operator<(const Ticks& lhs, const Ticks& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    82
  return lhs.value() < rhs.value();
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    83
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    84
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    85
inline bool operator>(const Ticks& lhs, const Ticks& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    86
  return operator<(rhs,lhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    87
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    88
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    89
inline bool operator<=(const Ticks& lhs, const Ticks& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    90
  return !operator>(lhs,rhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    91
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    92
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    93
inline bool operator>=(const Ticks& lhs, const Ticks& rhs) {
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    94
  return !operator<(lhs,rhs);
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    95
}
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    96
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
diff changeset
    97
#endif // SHARE_VM_UTILITIES_TICKS_INLINE_HPP