-package org.simantics.nativemem;
+/*******************************************************************************
+ * Copyright (c) 2016, 2017 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.nativemem.internal.win;
+
+import org.simantics.nativemem.ProcessMemoryInfo;
+import org.simantics.nativemem.internal.Util;
/**
* Architecture-independent version of the Windows PsApi PROCESS_MEMORY_COUNTERS
*
* @author Tuukka Lehtonen
*/
-public class ProcessMemoryCounters {
+public class ProcessMemoryCounters implements ProcessMemoryInfo {
public int PageFaultCount;
public long PeakWorkingSetSize;
public long WorkingSetSize;
public String toHumanReadableString() {
StringBuilder sb = new StringBuilder();
sb.append("ProcessMemoryCounters [\n\tPageFaultCount = ").append(PageFaultCount)
- .append(",\n\tPeakWorkingSetSize = ").append(toMb(PeakWorkingSetSize))
- .append(" MB,\n\tWorkingSetSize = ").append(toMb(WorkingSetSize))
- .append(" MB,\n\tQuotaPeakPagedPoolUsage = ").append(toMb(QuotaPeakPagedPoolUsage))
- .append(" MB,\n\tQuotaPagedPoolUsage = ").append(toMb(QuotaPagedPoolUsage))
- .append(" MB,\n\tQuotaPeakNonPagedPoolUsage = ").append(toMb(QuotaPeakNonPagedPoolUsage))
- .append(" MB,\n\tQuotaNonPagedPoolUsage = ").append(toMb(QuotaNonPagedPoolUsage))
- .append(" MB,\n\tPagefileUsage = ").append(toMb(PagefileUsage))
- .append(" MB,\n\tPeakPagefileUsage = ").append(toMb(PeakPagefileUsage))
- .append(" MB,\n\tPrivateUsage = ").append(toMb(PrivateUsage))
+ .append(",\n\tPeakWorkingSetSize = ").append(Util.toMb(PeakWorkingSetSize))
+ .append(" MB,\n\tWorkingSetSize = ").append(Util.toMb(WorkingSetSize))
+ .append(" MB,\n\tQuotaPeakPagedPoolUsage = ").append(Util.toMb(QuotaPeakPagedPoolUsage))
+ .append(" MB,\n\tQuotaPagedPoolUsage = ").append(Util.toMb(QuotaPagedPoolUsage))
+ .append(" MB,\n\tQuotaPeakNonPagedPoolUsage = ").append(Util.toMb(QuotaPeakNonPagedPoolUsage))
+ .append(" MB,\n\tQuotaNonPagedPoolUsage = ").append(Util.toMb(QuotaNonPagedPoolUsage))
+ .append(" MB,\n\tPagefileUsage = ").append(Util.toMb(PagefileUsage))
+ .append(" MB,\n\tPeakPagefileUsage = ").append(Util.toMb(PeakPagefileUsage))
+ .append(" MB,\n\tPrivateUsage = ").append(Util.toMb(PrivateUsage))
.append(" MB]");
return sb.toString();
}
- private double toMb(long bytes) {
- return (double) bytes / 1048576.0;
- }
-
}
\ No newline at end of file