性能計數器在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'
使用'性能監視器'來檢查計數器是否存在。 – Schaliasos 2013-04-11 06:54:20
安全權限問題? – 2013-04-11 07:00:02
計數器的名稱因OS版本而異。另外,有時它們會被破壞,將所有的計數器都變成數字。正如沙利亞索斯所說,用perfmon找到它。正如cad說的,嘗試在管理員權限下運行Visual Studio來排除安全問題。 – 2013-04-11 08:09:24