src/hotspot/os/posix/os_posix.inline.hpp
author dholmes
Tue, 05 Feb 2019 20:18:00 -0500
changeset 53654 7054249afee5
child 53886 e94ed0236046
permissions -rw-r--r--
8217843: Performance regression related to os::supports_monotonic_clock() on linux Reviewed-by: redestad, stuefe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53654
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     1
/*
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     4
 *
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     8
 *
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    13
 * accompanied this code).
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    14
 *
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    18
 *
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    21
 * questions.
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    22
 *
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    23
 */
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    24
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    25
#ifndef OS_POSIX_OS_POSIX_INLINE_HPP
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    26
#define OS_POSIX_OS_POSIX_INLINE_HPP
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    27
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    28
#include "runtime/os.hpp"
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    29
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    30
#ifdef SUPPORTS_CLOCK_MONOTONIC
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    31
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    32
// Exported clock functionality
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    33
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    34
inline bool os::Posix::supports_monotonic_clock() {
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    35
  return _clock_gettime != NULL;
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    36
}
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    37
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    38
inline int os::Posix::clock_gettime(clockid_t clock_id, struct timespec *tp) {
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    39
  return _clock_gettime != NULL ? _clock_gettime(clock_id, tp) : -1;
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    40
}
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    41
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    42
inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    43
  return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    44
}
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    45
#endif // SUPPORTS_CLOCK_MONOTONIC
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    46
7054249afee5 8217843: Performance regression related to os::supports_monotonic_clock() on linux
dholmes
parents:
diff changeset
    47
#endif // OS_POSIX_OS_POSIX_INLINE_HPP