Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

We come up so many times with the counters Processor (%Processor Time) and Process (%Processor Time) and when we see that there is high CPU in some server we want to analyze where this high CPU is coming from, which process is taking up our CPU. We may come up with a scenario where we observe a high CPU in the server at a particular point of time and want to find the cluprit.

So lets dive in

The Processor Object in the perfomance counter gives us a complete details on how our processor that is driving our computer is being used. If you are using a Multi Core processor you will see the instances of the each and every core of the server, and selecting the appropriate counter we can even calculate on how each individual CPU is being utilized.

And now if we go to the description of the counter (%Processor Time) in the Processor Object you will get it as

% Processor Time is the percentage of elapsed time that the processor spends to execute a non-Idle thread. It is calculated by measuring the percentage of time that the processor spends executing the idle thread and then subtracting that value from 100%. (Each processor has an idle thread that consumes cycles when no other threads are ready to run). This counter is the primary indicator of processor activity, and displays the average percentage of busy time observed during the sample interval. It should be noted that the accounting calculation of whether the processor is idle is performed at an internal sampling interval of the system clock (10ms). On todays fast processors, % Processor Time can therefore underestimate the processor utilization as the processor may be spending a lot of time servicing threads between the system clock sampling interval. Workload based timer applications are one example  of applications  which are more likely to be measured inaccurately as timers are signaled just after the sample is taken.

So we can generally take this Processor Time Counter as a Bench Mark in understanding the utilization of our Processor.

Suppose lets think over a standalone server we have hosted multiple SQL Instances and one of the Instance is consuming most of the CPU, or some antivirus or some Disk Backup is consuming the processor leading to the CPU Bottle necks for the other instance. If at that point of time if we are logged on to the server and if we see the task Manager and if we sort out the processes on the basis of the CPU we will be able to identify the process. What if it is happening daily at midnight when you have to go to sleep. How you are going to Monitor it?

The first thing that will come into your mind is configuring a Data Collector Set, Now what are you going to add in it?

So the solution is we have this object called Process. This Process object has the instances of all the process that are running over the server. And this counter has the objects which give us the Properties and the Settings that these processes are consuming. You will find so many Counters in the Process object, but today our main discussion is over Processor Time.

If you look into the description of the Process (%Processor Time) it looks like

% Processor Time is the percentage of elapsed time that all of process threads used the processor to execution instructions. An instruction is the basic unit of execution in a
computer, a thread is the object that executes instructions, and a process is the object created when a program is run. Code executed to handle some hardware interrupts and trap conditions are included in this count.
 
Now this Processor time counter under the Process Object gives the amount of CPU this Process is taking individually. This value is calculated over the base line of
(No of Logical CPUS * 100),  So this is going to be a calculated over a baselin of more than 100.

Lets think you are using a QUADCore System, so the baseline over which this Value is going to be calculated is 400. So now if we run the Datacollector Set and capture all the Process and sort them by the order of their Processor time, we will come up with the Process that is taking the most CPU in the server.

There may come up a condition that this Value is more than 400 ie. more than (No of Logical CPUS * 100) this indicates that the Process is extensively using Multithreading and using the Processor to more than its capacity.