performance - perfmon如何获取 "in Use"内存

标签 performance powershell memory perfmon

如果我查看任务管理器,我可以看到“正在使用”内存。 enter image description here

我知道我可以在 PerfMon 中获取性能信息,但我不知道 Perfmon 中的哪个计数器检索该值。

我想编写一个 PowerShell 脚本来找出过去一天的平均内存使用情况。 PerfMon 是我能想到的唯一选择。在 PowerShell 中是否有更好的方法来执行此操作?

最佳答案

Get-Counter -Counter 是在 PowerShell 2+ 中获取性能计数器的方法。 “使用中”看起来像是 Total Memory - Available 的舍入值:

[math]::Round(((((Get-Ciminstance Win32_OperatingSystem).TotalVisibleMemorySize * 1kb) - ((Get-Counter -Counter "\Memory\Available Bytes").CounterSamples.CookedValue)) / 1GB),1)

关于performance - perfmon如何获取 "in Use"内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43006654/

相关文章:

memory - 进程和进程镜像有什么区别?

java - Eclipse RCP : How to increase heap size for my RCP application?

java - 不同 Java 映射类型的每个映射值的相对内存开销是多少

python - 在非本地时区快速解析 Python 日期时间,调整夏令时

javascript - socket.io 自定义事件的确认

.net - 使用 Powershell 正则表达式查找 PHP 字符串,例如 "<?php eval "

powershell - Windows Powershell - 如何仅在某些 Windows 服务发生变化时重新显示它们的状态?

linux - 将文件读入内存并在脚本中重复使用

sql - 关于PostgreSQL性能的两个问题

function - 调用函数时出错