]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/win/ProcessMemoryCounters.java
Get rid of uses of gnu.trove2
[simantics/platform.git] / bundles / org.simantics.nativemem / src / org / simantics / nativemem / internal / win / ProcessMemoryCounters.java
1 /*******************************************************************************
2  * Copyright (c) 2016, 2017 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     Semantum Oy - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.nativemem.internal.win;
13
14 import org.simantics.nativemem.ProcessMemoryInfo;
15 import org.simantics.nativemem.internal.Util;
16
17 /**
18  * Architecture-independent version of the Windows PsApi PROCESS_MEMORY_COUNTERS
19  * structure.
20  * 
21  * @author Tuukka Lehtonen
22  */
23 public class ProcessMemoryCounters implements ProcessMemoryInfo {
24     public int PageFaultCount;
25     public long PeakWorkingSetSize;
26     public long WorkingSetSize;
27     public long QuotaPeakPagedPoolUsage;
28     public long QuotaPagedPoolUsage;
29     public long QuotaPeakNonPagedPoolUsage;
30     public long QuotaNonPagedPoolUsage;
31     public long PagefileUsage;
32     public long PeakPagefileUsage;
33     public long PrivateUsage;
34
35     @Override
36     public String toString() {
37         return "ProcessMemoryCounters [PageFaultCount="
38                 + PageFaultCount + ", PeakWorkingSetSize=" + PeakWorkingSetSize
39                 + ", WorkingSetSize=" + WorkingSetSize
40                 + ", QuotaPeakPagedPoolUsage=" + QuotaPeakPagedPoolUsage
41                 + ", QuotaPagedPoolUsage=" + QuotaPagedPoolUsage
42                 + ", QuotaPeakNonPagedPoolUsage=" + QuotaPeakNonPagedPoolUsage
43                 + ", QuotaNonPagedPoolUsage=" + QuotaNonPagedPoolUsage
44                 + ", PagefileUsage=" + PagefileUsage + ", PeakPagefileUsage="
45                 + PeakPagefileUsage + ", PrivateUsage=" + PrivateUsage + "]";
46     }
47
48     public String toHumanReadableString() {
49         StringBuilder sb = new StringBuilder();
50         sb.append("ProcessMemoryCounters [\n\tPageFaultCount             = ").append(PageFaultCount)
51         .append(",\n\tPeakWorkingSetSize         = ").append(Util.toMb(PeakWorkingSetSize))
52         .append(" MB,\n\tWorkingSetSize             = ").append(Util.toMb(WorkingSetSize))
53         .append(" MB,\n\tQuotaPeakPagedPoolUsage    = ").append(Util.toMb(QuotaPeakPagedPoolUsage))
54         .append(" MB,\n\tQuotaPagedPoolUsage        = ").append(Util.toMb(QuotaPagedPoolUsage))
55         .append(" MB,\n\tQuotaPeakNonPagedPoolUsage = ").append(Util.toMb(QuotaPeakNonPagedPoolUsage))
56         .append(" MB,\n\tQuotaNonPagedPoolUsage     = ").append(Util.toMb(QuotaNonPagedPoolUsage))
57         .append(" MB,\n\tPagefileUsage              = ").append(Util.toMb(PagefileUsage))
58         .append(" MB,\n\tPeakPagefileUsage          = ").append(Util.toMb(PeakPagefileUsage))
59         .append(" MB,\n\tPrivateUsage               = ").append(Util.toMb(PrivateUsage))
60         .append(" MB]");
61         return sb.toString();
62     }
63
64 }