X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.nativemem%2Fsrc%2Forg%2Fsimantics%2Fnativemem%2FNativeMem.java;h=c902214ac9bcee3711f747bbb31451100719a2f8;hb=refs%2Fchanges%2F93%2F393%2F3;hp=cfccc215447af083bbf6e5d032464309185400da;hpb=2531cdf245f42bce854d43f4d49a23983c79db96;p=simantics%2Fplatform.git
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java
index cfccc2154..c902214ac 100644
--- a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java
+++ b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java
@@ -1,56 +1,56 @@
-package org.simantics.nativemem;
-
-import org.simantics.nativemem.internal.Arch;
-import org.simantics.nativemem.internal.OS;
-import org.simantics.nativemem.internal.Psapi32;
-import org.simantics.nativemem.internal.Psapi64;
-
-import com.sun.jna.platform.win32.Kernel32;
-import com.sun.jna.platform.win32.WinNT.HANDLE;
-
-
-public class NativeMem {
-
- /**
- * @param out
- * the structure to write the result into or null
to
- * create a new structure
- * @return the result structure
- */
- public static ProcessMemoryCounters getMemoryCounters(ProcessMemoryCounters out) {
- if (out == null)
- out = new ProcessMemoryCounters();
-
- OS os = OS.calculate();
- Arch arch = Arch.calculate();
- switch (os) {
- case WINDOWS: {
- HANDLE proc = Kernel32.INSTANCE.GetCurrentProcess();
- switch (arch) {
- case X86: {
- Psapi32.PROCESS_MEMORY_COUNTERS_EX pmem = new Psapi32.PROCESS_MEMORY_COUNTERS_EX();
- boolean ok = Psapi32.INSTANCE.GetProcessMemoryInfo(proc, pmem, pmem.size());
- if (ok)
- pmem.writeTo(out);
- return out;
- }
-
- case X86_64: {
- Psapi64.PROCESS_MEMORY_COUNTERS_EX pmem = new Psapi64.PROCESS_MEMORY_COUNTERS_EX();
- boolean ok = Psapi64.INSTANCE.GetProcessMemoryInfo(proc, pmem, pmem.size());
- if (ok)
- pmem.writeTo(out);
- return out;
- }
-
- default:
- throw new UnsupportedOperationException("Architecture " + arch + " not supported on operating system " + os);
- }
- }
-
- default:
- throw new UnsupportedOperationException("Operating system " + os + " not supported");
- }
- }
-
+package org.simantics.nativemem;
+
+import org.simantics.nativemem.internal.Arch;
+import org.simantics.nativemem.internal.OS;
+import org.simantics.nativemem.internal.Psapi32;
+import org.simantics.nativemem.internal.Psapi64;
+
+import com.sun.jna.platform.win32.Kernel32;
+import com.sun.jna.platform.win32.WinNT.HANDLE;
+
+
+public class NativeMem {
+
+ /**
+ * @param out
+ * the structure to write the result into or null
to
+ * create a new structure
+ * @return the result structure
+ */
+ public static ProcessMemoryCounters getMemoryCounters(ProcessMemoryCounters out) {
+ if (out == null)
+ out = new ProcessMemoryCounters();
+
+ OS os = OS.calculate();
+ Arch arch = Arch.calculate();
+ switch (os) {
+ case WINDOWS: {
+ HANDLE proc = Kernel32.INSTANCE.GetCurrentProcess();
+ switch (arch) {
+ case X86: {
+ Psapi32.PROCESS_MEMORY_COUNTERS_EX pmem = new Psapi32.PROCESS_MEMORY_COUNTERS_EX();
+ boolean ok = Psapi32.INSTANCE.GetProcessMemoryInfo(proc, pmem, pmem.size());
+ if (ok)
+ pmem.writeTo(out);
+ return out;
+ }
+
+ case X86_64: {
+ Psapi64.PROCESS_MEMORY_COUNTERS_EX pmem = new Psapi64.PROCESS_MEMORY_COUNTERS_EX();
+ boolean ok = Psapi64.INSTANCE.GetProcessMemoryInfo(proc, pmem, pmem.size());
+ if (ok)
+ pmem.writeTo(out);
+ return out;
+ }
+
+ default:
+ throw new UnsupportedOperationException("Architecture " + arch + " not supported on operating system " + os);
+ }
+ }
+
+ default:
+ throw new UnsupportedOperationException("Operating system " + os + " not supported");
+ }
+ }
+
}
\ No newline at end of file