Documentation forSolarWinds Observability

Code profiling for .NET

Code profiling is currently supported only by the .NET Library for Windows.

Code profiling provides extra insight into code level execution time that is otherwise not captured by auto-instrumentation. See Code profiling for general information.

The granularity used for collecting profiling information with the .NET Library is based on the profiling interval. The default interval is 50ms and is configurable in profiler settings. Traces with a duration shorter than the configured profiling interval may not be profiled. The profiling information collected includes the .NET class name and method name. Asynchronous operations that are not part of a request do not have profiling information captured.

Troubleshooting .NET code profiling

Why don't all traces have profiling information?

Code profiling is disabled by default. To enabled code profiling use the Profiling setting in the solarwinds_apm.config file.

Traces with a duration shorter than the configured profiling interval (the default is 50ms) might not have profiling information.

What are the overhead concerns?

Overhead might be more noticeable in systems with a high number of threads. To reduce overhead, increase the code profiling interval so that the library takes snapshots less frequently.

What is the "UNKNOWN" path shown in the profiles?

"UNKNOWN" accounts for occasions where the library failed to obtain snapshots for the given interval. Various conditions can result in missing snapshots (for example, high CPU load).

What is the "UNMANAGED CODE" path shown in the profiles?

"UNMANAGED CODE" indicates that when the library attempted to take a snapshot, the code being executed was unmanaged code and the stack trace was not able to be taken.

What is the "SNAPSHOT NOT TAKEN" path shown in the profiles?

"SNAPSHOT NOT TAKEN" indicates that the library attempted to take the snapshot but the thread was not in a state where the stack trace could be taken.

How do I increase the library log level for profiling?

If the profiling information is missing or not expected and you’d like to provide our customer support with diagnostic logging, enable verbose logging for code profiling by adding the following to the library configuration.

<add key="LogLevel.Instrumentation.ProfilerService" value="Debug" />