1
2
3
4
5 package oshi.driver.windows.perfmon;
6
7 import static oshi.driver.windows.perfmon.PerfmonConstants.MEMORY;
8 import static oshi.driver.windows.perfmon.PerfmonConstants.WIN32_PERF_RAW_DATA_PERF_OS_MEMORY;
9
10 import java.util.Collections;
11 import java.util.Map;
12
13 import oshi.annotation.concurrent.ThreadSafe;
14 import oshi.util.platform.windows.PerfCounterQuery;
15 import oshi.util.platform.windows.PerfCounterQuery.PdhCounterProperty;
16
17
18
19
20 @ThreadSafe
21 public final class MemoryInformation {
22
23
24
25
26 public enum PageSwapProperty implements PdhCounterProperty {
27 PAGESINPUTPERSEC(null, "Pages Input/sec"),
28 PAGESOUTPUTPERSEC(null, "Pages Output/sec");
29
30 private final String instance;
31 private final String counter;
32
33 PageSwapProperty(String instance, String counter) {
34 this.instance = instance;
35 this.counter = counter;
36 }
37
38 @Override
39 public String getInstance() {
40 return instance;
41 }
42
43 @Override
44 public String getCounter() {
45 return counter;
46 }
47 }
48
49 private MemoryInformation() {
50 }
51
52
53
54
55
56
57 public static Map<PageSwapProperty, Long> queryPageSwaps() {
58 if (PerfmonDisabled.PERF_OS_DISABLED) {
59 return Collections.emptyMap();
60 }
61 return PerfCounterQuery.queryValues(PageSwapProperty.class, MEMORY, WIN32_PERF_RAW_DATA_PERF_OS_MEMORY);
62 }
63 }