System.Diagnostics.PerformanceCounterLib.GetPerformanceData C# (CSharp) Method

GetPerformanceData() private method

private GetPerformanceData ( string item ) : byte[]
item string
return byte[]
        internal byte[] GetPerformanceData(string item)
        {
            if (_performanceMonitor == null)
            {
                lock (InternalSyncObject)
                {
                    if (_performanceMonitor == null)
                        _performanceMonitor = new PerformanceMonitor(_machineName);
                }
            }

            return _performanceMonitor.GetData(item);
        }

Usage Example

        private static ProcessInfo[] GetProcessInfos(PerformanceCounterLib library)
        {
            ProcessInfo[] processInfos;

            int retryCount = 5;

            do
            {
                try
                {
                    byte[] dataPtr = library.GetPerformanceData(PerfCounterQueryString);
                    processInfos = GetProcessInfos(library, ProcessPerfCounterId, ThreadPerfCounterId, dataPtr);
                }
                catch (Exception e)
                {
                    throw new InvalidOperationException(SR.CouldntGetProcessInfos, e);
                }

                --retryCount;
            }while (processInfos.Length == 0 && retryCount != 0);

            if (processInfos.Length == 0)
            {
                throw new InvalidOperationException(SR.ProcessDisabled);
            }

            return(processInfos);
        }
All Usage Examples Of System.Diagnostics.PerformanceCounterLib::GetPerformanceData