Time is a valuable resource. If your application seems to be a bit sleepy and slow, it is a good reason to make time measurements and find a weak point.
Using dotTrace Performance you can measure execution time in several ways:
- Wall time (performance counter)
- Wall time (CPU instruction)
- Thread time
- Thread cycle time
Wall time (CPU instruction), also called real-world time or wall-clock time, is time elapsed between method entry and method exit. This approach makes no difference between the cases when a method consumes CPU and does some meaningful work and when a method is in a sleep, wait or join. dotTrace Performance measures time in both cases. So it reads values of TSC processor register on method entry and on method exit, then calculates the difference.
NoteIf the processor does not support CPU instruction, this way of measurement is unavailable.
Wall time (performance counter) is similar to Wall time (CPU instruction) except that it uses a slightly different way of measuring time intervals. dotTrace Performance uses Performance Counter API to retrieve and use performance counter data from operating system, network and devices for measuring time.
Thread time is the time measured by a thread-specific timer which is paused when its thread is paused (waiting for processor or sleeping). This kind of measurement is supported only for sampling profiling and has lower resolution than other methods (about 10ms).
Thread cycle time is the time measured by a thread-specific timer which is paused when its thread is paused (waiting for processor or sleeping). It is a bit more accurate way to time your application code. Actually, Thread cycle time is similar to Wall time (CPU instruction), it also uses CPU instruction to calculate the time, but does not take into account the time when thread does not do real work.
NoteAvailable on Windows Vista or higher.
To see the difference between wall time and thread time, consider the following example. Some function executes for 10 seconds. It is waiting for some data from the network for 8 seconds. And it is processing the data without sleeping or waiting for the remaining 2 seconds. Wall time for this function is 10 seconds. Thread time for this function is 2 seconds.
In tracing profiling, generally, due to OS limitations, measuring wall time is much faster than measuring thread time (up to 10 times faster). In case sampling profiling is used, measuring both kinds of time consumes the same overhead.