Exemplo n.º 1
0
        private static async Task ProfileAsync(int id)
        {
            var profiler = ProfilerFactory.GetCurrentProfiler();

            profiler.Start();

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

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