CPU - (CPU|Processor) Time Counter

System Metrics

About

Cpu time

The count of cycles, also known as clockticks, forms the basis for measuring how long a program takes to execute.

See: Time - System Time (Sysdate) / Current Time

Definition

How do you measure Execution Time?

<MATH> \begin{array}{rll} && \text{Kernel} && \text{Time} \\ + &&\text{User} && \text{Time} \\ \hline \\ && \text{Total} && \text{Time} \end{array} </MATH>

CPU Time Running which code
Kernel (Sys) Time Operating system code - the time of CPU spent on the kernel (system) code only within the given process - other processes and the time when our process is blocked are not included.
User Time Time CPU spends running the program code (ie CPU time spent on non-kernel (user-mode) code only within the given process – so other processes and the time when our process is blocked are not included.).
Total time User + Kernel
Real Time Wall clock (total elapsed time) (can be lower than total time because of parallelism or longer because of wait) - user-perceived time it took to execute the command – from the start to the end of the call, including time slices used by other processes and the time when our process is blocked (e.g. I/O waiting)

Process Explorer

CPU Time in process explorer

The performance tab of a process in Process Explorer. Red in the CPU usage graph indicates CPU usage in kernel-mode whereas green is the sum of kernel-mode and user-mode execution.
Cpu Process Explorer Perf Cpu System Information Process Explorer

A data collector set can be configured via logman.exe to log the “% Processor Time” counter in the “Processor Information” object for this purpose.

Formula

Every conventional processor has a clock with a fixed cycle time (or clock rate). At every CPU cycle, an instruction is executed.

<MATH> \text{CPU Time} = \text{CPU cycles executed} * \text{Cycle times} </MATH>

<MATH> \text{CPU cycles} = \text{Instructions executed} * \text{Average Clock Cycles per Instruction (CPI)} </MATH>

Putting it all together: <MATH> \text{CPU Execution Time} = \text{Instructions count} * \text{CPI} * \text{Clock Cycle Time} </MATH> where:

<MATH> \begin{array}{rll} \text{Instructions Count} && = && \frac{\displaystyle Instructions}{\displaystyle Programs} \\ \text{CPI} && = && \frac{\displaystyle Cycles}{\displaystyle Instruction} \\ \text{Clock Cycle Time} &&= && \frac{\displaystyle Seconds}{\displaystyle Cycle} \end{array} </MATH>

Note:

  • CPI is somewhat artificial (computed from the other numbers using) but it's seems to be intuitive and useful.
  • Use dynamic instruction count (#instructions executed), not static (#instructions in compiled code)

Performance

Response time distributed through the request lifetime

Busy vs Wait

Percentage shown in monitoring tool is generally: <MATH> \text{CPU Busy vs Wait Event} = \frac{\text{User} + \text{Kernel}}{\text{Wallclock Time}} </MATH>

CPU Performance

<MATH> \text{CPU Performance} = \frac{1}{\text{Total CPU Time}} </MATH>

System Performance

<MATH> \text{System Performance} = \frac{1}{\text{Wallclock Time}} </MATH>

Units (Mhz to ns)

  • Rate often measured in MHz = millions of cycles/second
  • Time often measured in ns (nanoseconds)

<MATH> \begin{array}{rl} {X} \mbox{ MHz } && = && \frac{\displaystyle 1000}{\displaystyle X} \mbox{ ns} \\ 500 \text{ MHz} && \approx && 2 \text{ ns clock} \end{array} </MATH>

Documentation / Reference





Discover More
System Metrics
(Operating) System Metrics

This article is the resources Metrics of an OS (Operating System) Meaning that they will report on all physical server functional components (CPUs, disks, busses, ...). The primary metrics are: CPUs...
System Metrics
CPU - (Metrics|Counter)

This page is counter / metrics for a CPU All metrics are System metrics. System Performance counters are CPU hardware registers that count hardware events such as instructions executed and cache-misses...
System Metrics
CPU - Performance

The CPU performance is defined as being the number of instructions per second (IPS) that a CPU can perform known also as the CPU throughput. The performance or speed of a processor depends on e.g.: ...
Clock Tick
Computer Clock - Clock Tick (Clock Cycle)

CPU's are marching forward at some frequency, and the period of this frequency is called a Clock Tick or Clock Cycle A 100Mhz processor will receive 100,000,000 clock ticks every second. The tick...
Process States
OS - Process (Main Thread) / Program

OS A process is the first thread started (called the main thread). It's the only thread that is authorized to start a new threads. A process is a unit of resources, while a thread is a unit of: scheduling...
Response Time Of System
Performance - (Latency|Response time|Running Time)

Latency is a performance metric also known as Response time. Latency (Response Time) is the amount of time take a system to process a request (ie to first response) from the outside or not, remote or...
System Metrics
What is the CPU Utilization ?

This page is the CPU Utilization metrics and is the most important metrics of all CPU metrics CPU utilization is defined as being: the amount of time spend not in the idle task. or the percentage...



Share this page:
Follow us:
Task Runner