Skip to content

7. Customize profiling steps

Teddy edited this page Nov 17, 2015 · 1 revision

NanoProfiler supports custom tags and data fields on any profiling timings.

You could add custom tags or data fields to session or steps like below:

ProfilingSession.Current.AddTag("tag1");
ProfilingSession.Current.AddField("key1", "value1");

...

using (var step = ProfilingSession.Current.Step("a step"))
{
    step.AddTag("tag1");
    step.AddField("key1", "value1");
}

The custom tags and data fields feature creates the possibility to analyze or wire the persisted profiling results later. For example, you could save user's login session id as a custom tag or field when starting a profiling session so that you could easily find all the profiling session results related to one login session from the persisted profiling logs.