简体   繁体   English

使用C#查找多个应用程序池的内存使用情况

[英]Finding memory usage of multiple App Pools using c#

I'm attempting to find how much of each App Pool's memory is being used through c# 我正在尝试通过c#查找每个应用程序池的内存量是多少

This is what I have at the moment: 这是我目前所拥有的:

List<ApplicationPool> pools = new List<ApplicationPool>();
List<WorkerProcess> processes = new List<WorkerProcess>();

ServerManager serverManager = new ServerManager();
ApplicationPoolCollection appPools = serverManager.ApplicationPools;

foreach (ApplicationPool pool in appPools)
{
    pools.Add(pool);
}

This gives me a list of all the App Pools I have running, but none of the properties of the ApplicationPool object give me any information about it's usage or and real-time data. 这给了我所有正在运行的应用程序池的列表,但是ApplicationPool对象的任何属性都没有给我有关其使用情况或实时数据的任何信息。

Have I got completely got the wrong end of the stick? 我完全弄错了杆子吗?

How do I find out the information I want? 我如何找到想要的信息?

I haven't been able to find a straight answer anywhere, but apologies if this has been answered before. 我无法在任何地方找到一个直接的答案,但是如果以前已经回答过,则表示歉意。

Cheers 干杯

You could use system.diagnostics to get the working set. 您可以使用system.diagnostics获取工作集。

The example in the link could be modified to get the working set for all w3wp.exe processes. 可以修改链接中的示例以获取所有w3wp.exe进程的工作集。

Is there a way to retrieve a C# app's current memory usage? 有没有办法检索C#应用程序的当前内存使用情况? .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM