X-Git-Url: https://gerrit.simantics.org/r/gitweb?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%2Finternal%2Fwin%2FProcessMemoryCounters.java;h=9c68a54483a437616562823c89d9b8d88757ebf8;hb=99f23679ed1b7c4a47cd841fa75be142225eb7aa;hp=0000000000000000000000000000000000000000;hpb=dec69b85e6e2a6d89e7ff0ef9561178924ae4b5b;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java new file mode 100644 index 000000000..9c68a5448 --- /dev/null +++ b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * 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 + * structure. + * + * @author Tuukka Lehtonen + */ +public class ProcessMemoryCounters implements ProcessMemoryInfo { + public int PageFaultCount; + public long PeakWorkingSetSize; + public long WorkingSetSize; + public long QuotaPeakPagedPoolUsage; + public long QuotaPagedPoolUsage; + public long QuotaPeakNonPagedPoolUsage; + public long QuotaNonPagedPoolUsage; + public long PagefileUsage; + public long PeakPagefileUsage; + public long PrivateUsage; + + @Override + public String toString() { + return "ProcessMemoryCounters [PageFaultCount=" + + PageFaultCount + ", PeakWorkingSetSize=" + PeakWorkingSetSize + + ", WorkingSetSize=" + WorkingSetSize + + ", QuotaPeakPagedPoolUsage=" + QuotaPeakPagedPoolUsage + + ", QuotaPagedPoolUsage=" + QuotaPagedPoolUsage + + ", QuotaPeakNonPagedPoolUsage=" + QuotaPeakNonPagedPoolUsage + + ", QuotaNonPagedPoolUsage=" + QuotaNonPagedPoolUsage + + ", PagefileUsage=" + PagefileUsage + ", PeakPagefileUsage=" + + PeakPagefileUsage + ", PrivateUsage=" + PrivateUsage + "]"; + } + + public String toHumanReadableString() { + StringBuilder sb = new StringBuilder(); + sb.append("ProcessMemoryCounters [\n\tPageFaultCount = ").append(PageFaultCount) + .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(); + } + +} \ No newline at end of file