如何在Powershell中获取进程的内存(私有工作集)? [英] How to get memory ( private working set ) of a process in powershell?

查看:232
本文介绍了如何在Powershell中获取进程的内存(私有工作集)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在任务管理器中,我们可以看到内存(私有工作集).

In task manager we can see memory ( private working set ).

我的问题是如何在Powershell中获取进程的内存(私有工作集)?看图片 ( https://i.stack.imgur.com/JQInb.jpg )

My question is How to get memory ( private working set ) of a process in powershell? See image (https://i.stack.imgur.com/JQInb.jpg)

推荐答案

一种解决方法是:

(Get-Counter "\Process(*)\Working Set - Private").CounterSamples

将值转换为MB:

以下内容获取Get-Counter的输出并按字母顺序对进程进行排序,然后创建一个表,并将工作集值转换为MB:

The following takes the output of Get-Counter and sorts the processes alphabetically, then creates a table with the Working Set value converted to MB:

(Get-Counter "\Process(*)\Working Set - Private").CounterSamples |
    Sort-Object InstanceName |
        Format-Table InstanceName, @{Label="PrivateWorkingSet"; Expression={$_.CookedValue / 1MB}} -AutoSize

这篇关于如何在Powershell中获取进程的内存(私有工作集)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆