This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#27212) * Use win32 api directly for workingset counter * Fix build warnings * Removing useless code * more cleanup * remove size annotation * remove useless comment * Move all the changes to Environment.WorkingSet and remove it from RuntimeEventSourceHelper * removing useless usings * Use kernel32.dll instead of psapi.dll * Code review feedback * Remove newline change * More code review nits
- Loading branch information
Showing
5 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessMemoryInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Kernel32 | ||
{ | ||
[StructLayout(LayoutKind.Sequential)] | ||
internal struct PROCESS_MEMORY_COUNTERS | ||
{ | ||
public uint cb; | ||
public uint PageFaultCount; | ||
public UIntPtr PeakWorkingSetSize; | ||
public UIntPtr WorkingSetSize; | ||
public UIntPtr QuotaPeakPagedPoolUsage; | ||
public UIntPtr QuotaPagedPoolUsage; | ||
public UIntPtr QuotaPeakNonPagedPoolUsage; | ||
public UIntPtr QuotaNonPagedPoolUsage; | ||
public UIntPtr PagefileUsage; | ||
public UIntPtr PeakPagefileUsage; | ||
} | ||
|
||
[DllImport(Libraries.Kernel32, EntryPoint="K32GetProcessMemoryInfo")] | ||
internal static extern bool GetProcessMemoryInfo(IntPtr Process, ref PROCESS_MEMORY_COUNTERS ppsmemCounters, uint cb); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters