public pCounter addCounter(string name, string memo) { pCounter pc = new pCounter(name, memo); this.allCounter.Add(pc); pc.ownCategory = this; return(pc); }
public static object getCounterValue(pCounter pc) { throw new NotImplementedException(); Process process = Process.GetCurrentProcess(); var isUnix = Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX; // var instanceName = isUnix ? string.Format("{0}/{1}", process.Id, process.ProcessName) : process.ProcessName.TrimEnd(".vshost".ToArray()); var instanceName = isUnix ? string.Format("{0}/{1}", process.Id, process.ProcessName) : GetProcessInstanceName(process.Id); Console.WriteLine("counter create"); //var counter = new PerformanceCounter(pc.ownCategory.Name, pc.Name, instanceName); // Console.WriteLine("counter value:{0}", counter.RawValue); //return counter.RawValue; }