1 11 package org.eclipse.test.internal.performance; 12 13 import java.util.Map ; 14 15 import org.eclipse.test.internal.performance.PerformanceMonitor; 16 17 20 class PerformanceMonitorWindows extends PerformanceMonitor { 21 22 23 private boolean fgNativeGetPerformanceInfoNotAvailable; 24 25 protected void collectOperatingSystemCounters(Map scalars) { 26 synchronized(this) { 27 if (org.eclipse.perfmsr.core.PerformanceMonitor.isLoaded()) { 28 long[] counters= new long[14]; 29 if (org.eclipse.perfmsr.core.PerformanceMonitor.nativeGetPerformanceCounters(counters)) { 30 addScalar(scalars, InternalDimensions.WORKING_SET, counters[0]); 31 addScalar(scalars, InternalDimensions.WORKING_SET_PEAK, counters[1]); 32 addScalar(scalars, InternalDimensions.ELAPSED_PROCESS, counters[2]); 33 addScalar(scalars, InternalDimensions.KERNEL_TIME, counters[4]); 35 addScalar(scalars, InternalDimensions.CPU_TIME, counters[3] + counters[4]); 36 addScalar(scalars, InternalDimensions.PAGE_FAULTS, counters[5]); 37 if (counters[6] != -1) 38 addScalar(scalars, InternalDimensions.COMITTED, counters[6]); 39 addScalar(scalars, InternalDimensions.GDI_OBJECTS, counters[7]); 40 } 48 } 49 super.collectOperatingSystemCounters(scalars); 50 } 51 } 52 53 62 protected void collectGlobalPerformanceInfo(Map scalars) { 63 synchronized(this) { 64 if (!fgNativeGetPerformanceInfoNotAvailable && org.eclipse.perfmsr.core.PerformanceMonitor.isLoaded()) { 65 long[] counters= new long[13]; 66 try { 67 org.eclipse.perfmsr.core.PerformanceMonitor.nativeGetPerformanceInfo(counters); 68 long pageSize= counters[9]; 69 addScalar(scalars, InternalDimensions.COMMIT_TOTAL, counters[0]*pageSize); 70 addScalar(scalars, InternalDimensions.COMMIT_LIMIT, counters[1]*pageSize); 71 addScalar(scalars, InternalDimensions.COMMIT_PEAK, counters[2]*pageSize); 72 addScalar(scalars, InternalDimensions.PHYSICAL_TOTAL, counters[3]*pageSize); 73 addScalar(scalars, InternalDimensions.PHYSICAL_AVAIL, counters[4]*pageSize); 74 addScalar(scalars, InternalDimensions.SYSTEM_CACHE, counters[5]*pageSize); 75 addScalar(scalars, InternalDimensions.KERNEL_TOTAL, counters[6]*pageSize); 76 addScalar(scalars, InternalDimensions.KERNEL_PAGED, counters[7]*pageSize); 77 addScalar(scalars, InternalDimensions.KERNEL_NONPAGED, counters[8]*pageSize); 78 addScalar(scalars, InternalDimensions.PAGE_SIZE, counters[9]); 79 addScalar(scalars, InternalDimensions.HANDLE_COUNT, counters[10]); 80 addScalar(scalars, InternalDimensions.PROCESS_COUNT, counters[11]); 81 addScalar(scalars, InternalDimensions.THREAD_COUNT, counters[12]); 82 } catch (Exception e) { 83 PerformanceTestPlugin.logWarning("native function GetPerformanceInfo() not available on this version of Windows"); fgNativeGetPerformanceInfoNotAvailable= true; 85 } 86 } 87 super.collectGlobalPerformanceInfo(scalars); 88 } 89 } 90 91 } 101 | Popular Tags |