Пример #1
0
        private static async Task ProfileAsync(int id)
        {
            var profiler = ProfilerFactory.GetCurrentProfiler();

            profiler.Start();

            await OperationAsync($"session_{id}", 0).ConfigureAwait(false);

            profiler.Stop();
        }
Пример #2
0
        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);
                    }
                }
            }
        }
Пример #3
0
 public static ProfileOperation Profile([NotNull] ProfileSession session, [NotNull] ProfileOperationSpecification specification)
 => ProfilerFactory.GetCurrentProfiler().Profile(session, specification);
Пример #4
0
 public static ProfileSession StartProfiling([CanBeNull] IDictionary <string, object> additionalSessionData = null)
 => ProfilerFactory.GetCurrentProfiler().Start(additionalSessionData);
Пример #5
0
 public static IProfiler GetCurrentProfiler() => ProfilerFactory.GetCurrentProfiler();
Пример #6
0
 /// <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);
Пример #7
0
 public ProfiledDbCommand(DbCommand innerCommand)
 {
     this.InnerCommand = innerCommand;
     this.profiler     = ProfilerFactory.GetCurrentProfiler();
 }