% Processor Time (Processor _Total)指处理器用来执行非闲置线程时间的百分比。计算方法是,度量处理器用来执行空闲线程的时间,然后用 100% 减去该值。(每个处理器有一个空闲线程,该线程在没有其他线程可以运行时消耗周期)。此计数器是处理器活动的主要指示器,显示在采样间隔期间所观察的繁忙时间平均百分比。应注意,对处理器是否空闲的计算是在系统时钟的内部采样间隔期间(10ms)执行的。考虑到现在的处理器速度非常快,因此,在处理器可能会用大量时间为系统时钟采样间隔之间的线程提供服务时,% Processor Time 会低估处理器利用率。当恰好进行采样后即向计时器发出信号时,更可能对应用程序做出不准确地度量,基于工作负荷的计时器应用程序是一个这样的示例。
%Processor Time (Process _Total) 是所有进程线程使用处理器执行指令所花的时间百分比。指令是计算机执行的基础单位。线程是执行指令的对象,进程是程序运行时创建的对象。此计数包括处理某些硬件间隔和陷阱条件所执行的代码。
System.Diagnostics.PerformanceCounter and % Processor Time on multi-core or multi-cpu
1. “\Process(…)\% Processor Time” can go up to N*100 (where N is the number of CPUs) because it adds up the CPU usage of the requested process across all the CPUs.
2. “\Process(_Total)\% Processor Time” should always be around N*100 (where N is the number CPUs) because it adds up the CPU usage of each process, including the idle process.
3. “\Processor(…)\% Processor Time” can go up to 100 because it’s the CPU usage of the requested CPU.
4. “\Processor(_Total)\% Processor Time” can go up to 100 because it’s the average CPU usage across all CPUs.
Examining Processor Time Data:
On multiprocessor systems, the Processor\% Processor Time value reported by System Monitor will never exceed 100 percent for any particular processor or thread. On the other hand, the value of the % Processor Time reported for the Process object can report values over 100 percent; if such values occur, this could indicate that threads of the process are cumulatively using more than 100 percent of a processor. To get more detailed information, use the Thread object counters to analyze the processor time each thread within a process is using. Investigating other data described in this section, such as DPC activity or context switching, might help you to interpret high processor-time values.
多处理器系统中,由系统监视报告的处理器Processor Time%值对任何个别处理器或线程不会超出100%。另一方面,进程对象Processor Time%报告值能超出100%,如果超出就意味着该进程的这些线程在累加地超出100%使用一个处理器。要得到更详尽的信息,使用线程对象计数器去分析该处理器在一个进程里使用每个线程的时间。调查在这部分描述的其它数据,如延迟过程调用(DPC)活动或上下文切换,可能会帮助你去解释高Processor Time%值。
Resource Manager may report % Processor Utilization to be more than 100% for some reports on Multi-Processor servers
Processor usage of each process on the server is sampled at regular intervals using a standard operating system call - note that the operating system call used returns the sum of processor time used by all threads within the process. Resource Manager expresses the processor time used during the sampled interval as a percentage by dividing this time by the elapsed time since the previous sample.
On a multi-processor system it is quite possible for the percentage reported to exceed 100% in the case of a multi-threaded process. For example, on a dual-processor system, a multi-threaded process in which two threads are performing lengthy processor intensive calculations would cause a value of about 200% to be recorded.
This process-specific processor utilization is useful for gauging the state (and possibly health) of the process; if a process which normally uses little processor time is seen to be consuming a figure approaching 100%, a likely explanation is that it has encountered a bug which has caused it to enter an uncontrolled looping state.