
2/13/2024 · Christophe Nasarre
What this post added
This post details the implementation of CPU and wall time profiling within the Datadog .NET continuous profiler. It explains how application threads are monitored and sampled for CPU and wall time, including the use of `ICorProfilerCallback` methods for thread lifecycle management and the `StackSamplerLoop` class for sampling. It also covers the identification and monitoring of special native threads like those from the garbage collector. For CPU profiling, it describes the sampling frequency, the `IsRunning` function for checking thread status and CPU consumption on Windows and Linux, and the calculation of CPU time consumed. An internal example of using the CPU profiler to reduce CPU consumption is mentioned, along with performance optimizations for the `OsSpecificApi::GetCpuInfo` function.