src/windows/native/sun/management/OperatingSystemImpl.c

Print this page

        

*** 26,36 **** #include "jni.h" #include "jni_util.h" #include "jlong.h" #include "jvm.h" #include "management.h" ! #include "com_sun_management_OperatingSystem.h" #include <psapi.h> #include <errno.h> #include <stdlib.h> --- 26,36 ---- #include "jni.h" #include "jni_util.h" #include "jlong.h" #include "jvm.h" #include "management.h" ! #include "sun_management_OperatingSystemImpl.h" #include <psapi.h> #include <errno.h> #include <stdlib.h>
*** 75,93 **** static HANDLE main_process; int perfiInit(void); JNIEXPORT void JNICALL ! Java_com_sun_management_OperatingSystem_initialize (JNIEnv *env, jclass cls) { main_process = GetCurrentProcess(); perfiInit(); } JNIEXPORT jlong JNICALL ! Java_com_sun_management_OperatingSystem_getCommittedVirtualMemorySize0 (JNIEnv *env, jobject mbean) { PROCESS_MEMORY_COUNTERS pmc; if (GetProcessMemoryInfo(main_process, &pmc, sizeof(PROCESS_MEMORY_COUNTERS)) == 0) { return (jlong)-1L; --- 75,93 ---- static HANDLE main_process; int perfiInit(void); JNIEXPORT void JNICALL ! Java_sun_management_OperatingSystemImpl_initialize (JNIEnv *env, jclass cls) { main_process = GetCurrentProcess(); perfiInit(); } JNIEXPORT jlong JNICALL ! Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0 (JNIEnv *env, jobject mbean) { PROCESS_MEMORY_COUNTERS pmc; if (GetProcessMemoryInfo(main_process, &pmc, sizeof(PROCESS_MEMORY_COUNTERS)) == 0) { return (jlong)-1L;
*** 95,125 **** return (jlong) pmc.PagefileUsage; } } JNIEXPORT jlong JNICALL ! Java_com_sun_management_OperatingSystem_getTotalSwapSpaceSize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); return (jlong) ms.ullTotalPageFile; } JNIEXPORT jlong JNICALL ! Java_com_sun_management_OperatingSystem_getFreeSwapSpaceSize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); return (jlong) ms.ullAvailPageFile; } JNIEXPORT jlong JNICALL ! Java_com_sun_management_OperatingSystem_getProcessCpuTime (JNIEnv *env, jobject mbean) { FILETIME process_creation_time, process_exit_time, process_user_time, process_kernel_time; --- 95,125 ---- return (jlong) pmc.PagefileUsage; } } JNIEXPORT jlong JNICALL ! Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); return (jlong) ms.ullTotalPageFile; } JNIEXPORT jlong JNICALL ! Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); return (jlong) ms.ullAvailPageFile; } JNIEXPORT jlong JNICALL ! Java_sun_management_OperatingSystemImpl_getProcessCpuTime (JNIEnv *env, jobject mbean) { FILETIME process_creation_time, process_exit_time, process_user_time, process_kernel_time;
*** 134,154 **** jlong_from(process_kernel_time.dwHighDateTime, process_kernel_time.dwLowDateTime)) * 100; } JNIEXPORT jlong JNICALL ! Java_com_sun_management_OperatingSystem_getFreePhysicalMemorySize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); return (jlong) ms.ullAvailPhys; } JNIEXPORT jlong JNICALL ! Java_com_sun_management_OperatingSystem_getTotalPhysicalMemorySize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); --- 134,154 ---- jlong_from(process_kernel_time.dwHighDateTime, process_kernel_time.dwLowDateTime)) * 100; } JNIEXPORT jlong JNICALL ! Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); return (jlong) ms.ullAvailPhys; } JNIEXPORT jlong JNICALL ! Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms);
*** 925,941 **** return error; } JNIEXPORT jdouble JNICALL ! Java_com_sun_management_OperatingSystem_getSystemCpuLoad (JNIEnv *env, jobject dummy) { return perfGetCPULoad(-1); } JNIEXPORT jdouble JNICALL ! Java_com_sun_management_OperatingSystem_getProcessCpuLoad (JNIEnv *env, jobject dummy) { return perfGetProcessLoad(); } --- 925,941 ---- return error; } JNIEXPORT jdouble JNICALL ! Java_sun_management_OperatingSystemImpl_getSystemCpuLoad (JNIEnv *env, jobject dummy) { return perfGetCPULoad(-1); } JNIEXPORT jdouble JNICALL ! Java_sun_management_OperatingSystemImpl_getProcessCpuLoad (JNIEnv *env, jobject dummy) { return perfGetProcessLoad(); }