-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMemInfo.cs
45 lines (42 loc) · 1.53 KB
/
MemInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace CpuTime
{
public class WinApiHelpers
{
[DllImport("psapi.dll", SetLastError = true)]
public static extern bool GetProcessMemoryInfo(IntPtr hProcess, out PROCESS_MEMORY_COUNTERS counters, uint size);
[StructLayout(LayoutKind.Sequential, Size = 72)]
public struct PROCESS_MEMORY_COUNTERS_64
{
public uint cb;
public uint PageFaultCount;
public UInt64 PeakWorkingSetSize;
public UInt64 WorkingSetSize;
public UInt64 QuotaPeakPagedPoolUsage;
public UInt64 QuotaPagedPoolUsage;
public UInt64 QuotaPeakNonPagedPoolUsage;
public UInt64 QuotaNonPagedPoolUsage;
public UInt64 PagefileUsage;
public UInt64 PeakPagefileUsage;
}
[StructLayout(LayoutKind.Sequential, Size = 40)]
public struct PROCESS_MEMORY_COUNTERS
{
public uint cb;
public uint PageFaultCount;
public uint PeakWorkingSetSize;
public uint WorkingSetSize;
public uint QuotaPeakPagedPoolUsage;
public uint QuotaPagedPoolUsage;
public uint QuotaPeakNonPagedPoolUsage;
public uint QuotaNonPagedPoolUsage;
public uint PagefileUsage;
public uint PeakPagefileUsage;
}
}
}