public PerformanceScopeGroupStopWatch(PerformanceScope scope, string group)
 {
     _group = @group;
     Scope  = scope;
     _sw    = new Stopwatch();
     _sw.Start();
 }
 public PerformanceScope(string name, PerformanceScope parent)
 {
     Name = name;
     StartedOn = DateTime.Now;
     _parent = parent;
     Elapsed = TimeSpan.Zero;
     _subProfilers = new ConcurrentBag<PerformanceScope>();
     _groupedProfilers = new ConcurrentDictionary<string, long>();
     if (parent != null)
     {
         parent.AddSubProfiler(this);
     }
 }
 public PerformanceScope(string name, PerformanceScope parent)
 {
     Name              = name;
     StartedOn         = DateTime.Now;
     _parent           = parent;
     Elapsed           = TimeSpan.Zero;
     _subProfilers     = new ConcurrentBag <PerformanceScope>();
     _groupedProfilers = new ConcurrentDictionary <string, long>();
     if (parent != null)
     {
         parent.AddSubProfiler(this);
     }
 }
        public static IPerformanceScopeWrapper Create(string name, params object[] args)
        {
            if (!IsEnabled)
            {
                return(new ProfilerDisabled());
            }
            var data     = CallContext.LogicalGetData(Key);
            var parent   = data as PerformanceScope;
            var profiler = new PerformanceScope(string.Format(name, args), parent);

            CallContext.LogicalSetData(Key, profiler);
            return(new PerformanceScopeStopWatch(profiler));
        }
 public PerformanceScopeStopWatch(PerformanceScope scope)
 {
     Scope = scope;
     _sw = new Stopwatch();
     _sw.Start();
 }
 public PerformanceScopeGroupStopWatch(PerformanceScope scope, string group)
 {
     _group = @group;
     Scope = scope;
     _sw = new Stopwatch();
     _sw.Start();
 }
 private void AddSubProfiler(PerformanceScope scope)
 {
     _subScopesArray = null;
     _subProfilers.Add(scope);
 }
 public static IPerformanceScopeWrapper Create(string name, params object[] args)
 {
     if (!IsEnabled)
     {
         return new ProfilerDisabled();
     }
     var data = CallContext.LogicalGetData(Key);
     var parent = data as PerformanceScope;
     var profiler = new PerformanceScope(string.Format(name, args), parent);
     CallContext.LogicalSetData(Key, profiler);
     return new PerformanceScopeStopWatch(profiler);
 }
 public PerformanceScopeStopWatch(PerformanceScope scope)
 {
     Scope = scope;
     _sw   = new Stopwatch();
     _sw.Start();
 }
 private void AddSubProfiler(PerformanceScope scope)
 {
     _subScopesArray = null;
     _subProfilers.Add(scope);
 }