X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.nativemem%2Fsrc%2Forg%2Fsimantics%2Fnativemem%2Finternal%2Fwin%2FProcessMemoryCounters.java;fp=bundles%2Forg.simantics.nativemem%2Fsrc%2Forg%2Fsimantics%2Fnativemem%2FProcessMemoryCounters.java;h=9c68a54483a437616562823c89d9b8d88757ebf8;hp=eb60540f6612ce02f6f87120c2037cc5943421ee;hb=99f23679ed1b7c4a47cd841fa75be142225eb7aa;hpb=dec69b85e6e2a6d89e7ff0ef9561178924ae4b5b diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/ProcessMemoryCounters.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java similarity index 63% rename from bundles/org.simantics.nativemem/src/org/simantics/nativemem/ProcessMemoryCounters.java rename to bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java index eb60540f6..9c68a5448 100644 --- a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/ProcessMemoryCounters.java +++ b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java @@ -1,4 +1,18 @@ -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 @@ -6,7 +20,7 @@ package org.simantics.nativemem; * * @author Tuukka Lehtonen */ -public class ProcessMemoryCounters { +public class ProcessMemoryCounters implements ProcessMemoryInfo { public int PageFaultCount; public long PeakWorkingSetSize; public long WorkingSetSize; @@ -34,21 +48,17 @@ public class ProcessMemoryCounters { 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