mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8246112: Remove build-time and run-time checks for clock_gettime and CLOCK_MONOTONIC
Reviewed-by: ihse, erikj, gziemski, hseigel
This commit is contained in:
parent
19b6f61bd2
commit
6f2be9c608
16 changed files with 90 additions and 359 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -56,12 +56,13 @@ class CPUPerformanceInterface::CPUPerformance : public CHeapObj<mtInternal> {
|
|||
int _active_processor_count;
|
||||
|
||||
bool now_in_nanos(long* resultp) {
|
||||
timeval current_time;
|
||||
if (gettimeofday(¤t_time, NULL) != 0) {
|
||||
// Error getting current time
|
||||
struct timespec tp;
|
||||
int status = clock_gettime(CLOCK_REALTIME, &tp);
|
||||
assert(status == 0, "clock_gettime error: %s", os::strerror(errno));
|
||||
if (status != 0) {
|
||||
return false;
|
||||
}
|
||||
*resultp = current_time.tv_sec * NANOS_PER_SEC + 1000L * current_time.tv_usec;
|
||||
*resultp = tp.tv_sec * NANOS_PER_SEC + tp.tv_nsec;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue