c# - 性能计数器不工作

标签 c# performancecounter ranorex

性能计数器在 c# 中不工作。我认为这是一个系统问题。因为,它在其他系统中运行良好。如何纠正?它显示以下代码的错误:

来自 Ranorex 工具的代码:

string prcName = "chrome";
PerformanceCounter counter = new PerformanceCounter("Process", "Working Set - Private",prcName)
Report.Info("MonAlbum  memory", (counter.RawValue / 1024).ToString("#,##0")+" KB");

错误:

Can not find the performance counter with the specified classname 'Process' countername 'Working Set - Private'

最佳答案

您是否在旧操作系统版本下运行测试?

如前所述here , Process/Working Set - Private 在 Windows Server 2003 和 Windows XP 下不受支持。

enter image description here

好像有解决办法here , 但我从未尝试过。

关于c# - 性能计数器不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15942264/

相关文章:

c# - Ranorex 测试自动化问题 : Unable to reliably click a button on silverlight web app

c# - 流利的 NHibernate : SetBatchSize vs. AdoNetBatchSize

php - Cakephp counterCache 多个 counterScope - 逻辑问题

c# - 性能计数器

windows - 使用 "SupressWhenMinimzed"安全关闭 RDP session 后,远程计算机的屏幕分辨率发生变化

.net - 如何从 MTM 运行 Ranorex 自动化测试?

C# XAML MVVM Treeview 控件数据绑定(bind)

C# Newtonsoft.Json.Linq.JValue 总是返回 Int64

c# - 创建排序 Func<IQueryable<T>、IOrderedQueryable<T>>?

c# - 如何跟踪进程内存和 CPU?