Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Wall and CPU times when profiling .NEt applications

When profiling .NET applications, it's essential to understand the concepts of CPU time and wall time to make informed decisions about application performance optimization. These two metrics represent different aspects of the time taken by your .NET application during execution, and each can provide valuable insights depending on your specific use case.

CPU time

CPU time, also known as process time, refers to the amount of time the CPU spends actively executing instructions for a specific process or thread. This metric only considers the time during which a CPU is working on behalf of the process, excluding any time spent waiting for external resources, input/output operations, or other processes.

Usage: CPU time is particularly useful for identifying computationally intensive parts of your .NET application. By focusing on the sections of your code that consume the most CPU time, you can pinpoint areas where optimization may lead to improved overall performance.

Wall time

Wall time, also known as real time or elapsed time, is the total time taken from the start to the completion of a process or operation, as measured by a regular clock. Wall time includes all time intervals, including waiting for resources, input/output operations, or other processes, as well as active execution time.

Usage: Wall time is valuable for understanding the actual user-perceived execution time of your .NET application or specific parts of it. Profiling using wall time can help identify bottlenecks due to resource contention, slow I/O, or other non-computation-related delays that impact the overall responsiveness of your application.

Differences between CPU time and wall time

The main difference between CPU time and wall time lies in what they measure. CPU time focuses on the active computation time of the CPU, excluding any waiting periods. In contrast, wall time considers the entire duration of a process or operation, including both active execution and waiting times.

As a result, CPU time can be shorter than wall time, especially in multi-threaded or multi-process applications where processes might be waiting for resources, I/O, or other processes to complete.

When to use CPU time vs. wall time

Use CPU time when

  • Profiling computationally intensive parts of your .NET application.
  • Identifying functions or methods that consume excessive CPU cycles.
  • Diagnosing performance issues related to algorithmic complexity, inefficient data structures, or other code-level optimizations.

Use wall time when

  • Profiling the overall user-perceived execution time of your .NET application.
  • Identifying bottlenecks due to resource contention, slow I/O operations, or other external factors.
  • Understanding the impact of waiting times on your application's responsiveness.

CPU and wall times in YourKit .NET Profiler

YourKit .NET Profiler has reasonable default settings, as well as a flexible system for configuring wall time and CPU time for all profiling modes:

1. CPU sampling measure CPU time by default, but it can be configured to measure wall time.

2. CPU tracing measures wall time by default, and can be configured to measure CPU time instead.

You can choose between CPU and wall time measurement in CPU sampling settings and CPU tracing settings.

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.