GetPerformanceData() private method

private GetPerformanceData ( string item ) : byte[]
item string
return byte[]
コード例 #1
0
        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);
        }
コード例 #2
0
 private static ProcessInfo[] GetProcessInfos(PerformanceCounterLib library)
 {
     ProcessInfo[] infoArray = new ProcessInfo[0];
     byte[]        data      = null;
     for (int i = 5; (infoArray.Length == 0) && (i != 0); i--)
     {
         try
         {
             data      = library.GetPerformanceData("230 232");
             infoArray = GetProcessInfos(library, 230, 0xe8, data);
         }
         catch (Exception exception)
         {
             throw new InvalidOperationException(SR.GetString("CouldntGetProcessInfos"), exception);
         }
     }
     if (infoArray.Length == 0)
     {
         throw new InvalidOperationException(SR.GetString("ProcessDisabled"));
     }
     return(infoArray);
 }
コード例 #3
0
 static ProcessInfo[] GetProcessInfos(PerformanceCounterLib library) {
     ProcessInfo[] processInfos = new ProcessInfo[0] ;
     byte[] dataPtr = null;
     
     int retryCount = 5;
     while (processInfos.Length == 0 && retryCount != 0) {                    
         try {
             dataPtr = library.GetPerformanceData(PerfCounterQueryString);
             processInfos = GetProcessInfos(library, ProcessPerfCounterId, ThreadPerfCounterId, dataPtr);
         }
         catch (Exception e) {
             throw new InvalidOperationException(SR.GetString(SR.CouldntGetProcessInfos), e);
         }
                                 
         --retryCount;                        
     }                    
 
     if (processInfos.Length == 0)
         throw new InvalidOperationException(SR.GetString(SR.ProcessDisabled));    
         
     return processInfos;                    
                 
 }
 private static ProcessInfo[] GetProcessInfos(PerformanceCounterLib library)
 {
     ProcessInfo[] infoArray = new ProcessInfo[0];
     byte[] data = null;
     for (int i = 5; (infoArray.Length == 0) && (i != 0); i--)
     {
         try
         {
             data = library.GetPerformanceData("230 232");
             infoArray = GetProcessInfos(library, 230, 0xe8, data);
         }
         catch (Exception exception)
         {
             throw new InvalidOperationException(SR.GetString("CouldntGetProcessInfos"), exception);
         }
     }
     if (infoArray.Length == 0)
     {
         throw new InvalidOperationException(SR.GetString("ProcessDisabled"));
     }
     return infoArray;
 }