wasSharpNET – Diff between revs 1 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 1 Rev 3
Line 17... Line 17...
17 /// <returns>the instance name of a process or null if the instance name was not found</returns> 17 /// <returns>the instance name of a process or null if the instance name was not found</returns>
18 /// <remarks>(C) Ingo Rammer</remarks> 18 /// <remarks>(C) Ingo Rammer</remarks>
19 public static string GetProcessInstanceName(this System.Diagnostics.Process proc) 19 public static string GetProcessInstanceName(this System.Diagnostics.Process proc)
20 { 20 {
21 var cat = new PerformanceCounterCategory("Process"); 21 var cat = new PerformanceCounterCategory("Process");
22 22  
23 foreach (var instance in cat.GetInstanceNames()) 23 foreach (var instance in cat.GetInstanceNames())
24 { 24 {
25 using (var cnt = new PerformanceCounter("Process", "ID Process", instance, true)) 25 using (var cnt = new PerformanceCounter("Process", "ID Process", instance, true))
26 { 26 {
27 var val = (int) cnt.RawValue; 27 var val = (int) cnt.RawValue;