private static async Task ProfileAsync(int id) { var profiler = ProfilerFactory.GetCurrentProfiler(); profiler.Start(); await OperationAsync($"session_{id}", 0).ConfigureAwait(false); profiler.Stop(); }
private static async Task OperationAsync(string namePrefix, int level) { var profiler = ProfilerFactory.GetCurrentProfiler(); for (var k = 0; k < 10; k++) { var name = $"{namePrefix}_{k}"; using (profiler.Profile(new ProfileOperationSpecification(name))) { if (level < 5 && RandomizationExtensions.Random.NextBool()) { await OperationAsync(name, level + 1).ConfigureAwait(false); } } } }
public static ProfileOperation Profile([NotNull] ProfileSession session, [NotNull] ProfileOperationSpecification specification) => ProfilerFactory.GetCurrentProfiler().Profile(session, specification);
public static ProfileSession StartProfiling([CanBeNull] IDictionary <string, object> additionalSessionData = null) => ProfilerFactory.GetCurrentProfiler().Start(additionalSessionData);
public static IProfiler GetCurrentProfiler() => ProfilerFactory.GetCurrentProfiler();
/// <summary> /// Stops specified profile <paramref name="session"/> and stores the results. /// </summary> public static void StopProfiling([NotNull] ProfileSession session, [CanBeNull] IDictionary <string, object> additionalSessionData = null) => ProfilerFactory.GetCurrentProfiler().Stop(session, additionalSessionData);
public ProfiledDbCommand(DbCommand innerCommand) { this.InnerCommand = innerCommand; this.profiler = ProfilerFactory.GetCurrentProfiler(); }