简体   繁体   中英

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#

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.

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.

The example in the link could be modified to get the working set for all w3wp.exe processes.

Is there a way to retrieve a C# app's current memory usage? .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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