Quantcast
Channel: C#
Viewing all articles
Browse latest Browse all 1853

CPU Time and Wait Time

$
0
0

Intel® VTune™ Amplifier measures and displays analysis specific time. Thus, for example, the Hotspot and Concurrency analysis results show active CPU time spent executing program units. The Locks and Waits analysis results show Wait time spent waiting for events to occur.

CPU Time

CPU time is the amount of time a thread spends executing on a logical processor. For multiple threads, the CPU time of the threads is summed. The application CPU time is the sum of the CPU time of all the threads that run the application.

You can see the distribution of CPU time over program units in the Bottom-up, Top-down Tree, Source/Assembly, and Timeline panes.

Wait Time

Wait time is the amount of time that a given thread waited for some event to occur, such as synchronization waits and I/O waits. VTune Amplifier finds both for you.

As with CPU time, you can see the distribution of Wait time over program units in the Bottom-up, Top-down Tree, Source/Assembly, and Timeline panes.

The following example depicts Elapsed time, CPU time and Wait time in a typical multithreaded program:

The Elapsed time for the application is 6 seconds. The application has three threads:

  • The first thread ran for one second, waited for two seconds, then ran for three seconds and stopped.

  • The second thread started at second two of the program lifetime, ran for one second, waited for three seconds, then ran for one second and stopped.

  • The third thread started at second three of the program lifetime, ran for one second, then waited for two seconds, then ran for one second and stopped.

The CPU time is:

(1+3)+(1+1)+(1+1) = 8 seconds.

The Wait time is:

(2)+(3)+(2) = 7 seconds.

There is no ordered relationship between CPU, Wait and Elapsed times - there are cases when one can be less or greater than the other two:

  • In a single-threaded program, CPU time and Wait time can be less than or equal to the Elapsed time because the Elapsed time is a sum of CPU time and Wait time for the only thread the program has.

  • For a multithreaded program, the Elapsed time can be less or greater than the CPU time or Wait time depending on how many threads the program has and the behavior of those threads.

 

See Also


Supplemental documentation specific to a particular Intel Studio may be available at <install-dir>\<studio>\documentation\ .

Inglese

Viewing all articles
Browse latest Browse all 1853

Trending Articles