src/os/windows/vm/os_windows.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1997, 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 626,637 ****
CloseHandle(osthread->thread_handle());
CloseHandle(osthread->interrupt_event());
delete osthread;
}
-
- static int has_performance_count = 0;
static jlong first_filetime;
static jlong initial_performance_count;
static jlong performance_frequency;
--- 626,635 ----
*** 643,653 ****
}
jlong os::elapsed_counter() {
LARGE_INTEGER count;
! if (has_performance_count) {
QueryPerformanceCounter(&count);
return as_long(count) - initial_performance_count;
} else {
FILETIME wt;
GetSystemTimeAsFileTime(&wt);
--- 641,651 ----
}
jlong os::elapsed_counter() {
LARGE_INTEGER count;
! if (win32::_has_performance_count) {
QueryPerformanceCounter(&count);
return as_long(count) - initial_performance_count;
} else {
FILETIME wt;
GetSystemTimeAsFileTime(&wt);
*** 655,665 ****
}
}
jlong os::elapsed_frequency() {
! if (has_performance_count) {
return performance_frequency;
} else {
// the FILETIME time is the number of 100-nanosecond intervals since January 1,1601.
return 10000000;
}
--- 653,663 ----
}
}
jlong os::elapsed_frequency() {
! if (win32::_has_performance_count) {
return performance_frequency;
} else {
// the FILETIME time is the number of 100-nanosecond intervals since January 1,1601.
return 10000000;
}
*** 734,752 ****
bool os::bind_to_processor(uint processor_id) {
// Not yet implemented.
return false;
}
! static void initialize_performance_counter() {
LARGE_INTEGER count;
if (QueryPerformanceFrequency(&count)) {
! has_performance_count = 1;
performance_frequency = as_long(count);
QueryPerformanceCounter(&count);
initial_performance_count = as_long(count);
} else {
! has_performance_count = 0;
FILETIME wt;
GetSystemTimeAsFileTime(&wt);
first_filetime = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
}
}
--- 732,750 ----
bool os::bind_to_processor(uint processor_id) {
// Not yet implemented.
return false;
}
! void os::win32::initialize_performance_counter() {
LARGE_INTEGER count;
if (QueryPerformanceFrequency(&count)) {
! win32::_has_performance_count = 1;
performance_frequency = as_long(count);
QueryPerformanceCounter(&count);
initial_performance_count = as_long(count);
} else {
! win32::_has_performance_count = 0;
FILETIME wt;
GetSystemTimeAsFileTime(&wt);
first_filetime = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
}
}
*** 837,847 ****
return windows_to_java_time(wt);
}
}
jlong os::javaTimeNanos() {
! if (!has_performance_count) {
return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do.
} else {
LARGE_INTEGER current_count;
QueryPerformanceCounter(¤t_count);
double current = as_long(current_count);
--- 835,845 ----
return windows_to_java_time(wt);
}
}
jlong os::javaTimeNanos() {
! if (!win32::_has_performance_count) {
return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do.
} else {
LARGE_INTEGER current_count;
QueryPerformanceCounter(¤t_count);
double current = as_long(current_count);
*** 850,860 ****
return time;
}
}
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
! if (!has_performance_count) {
// javaTimeMillis() doesn't have much percision,
// but it is not going to wrap -- so all 64 bits
info_ptr->max_value = ALL_64_BITS;
// this is a wall clock timer, so may skip
--- 848,858 ----
return time;
}
}
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
! if (!win32::_has_performance_count) {
// javaTimeMillis() doesn't have much percision,
// but it is not going to wrap -- so all 64 bits
info_ptr->max_value = ALL_64_BITS;
// this is a wall clock timer, so may skip
*** 3680,3689 ****
--- 3678,3689 ----
bool os::win32::_is_nt = false;
bool os::win32::_is_windows_2003 = false;
bool os::win32::_is_windows_server = false;
+ bool os::win32::_has_performance_count = 0;
+
void os::win32::initialize_system_info() {
SYSTEM_INFO si;
GetSystemInfo(&si);
_vm_page_size = si.dwPageSize;
_vm_allocation_granularity = si.dwAllocationGranularity;