/// <summary> /// Creates a new instance of Profiler with custom name. /// </summary> /// <param name="options">Profiler options</param> /// <param name="name">Name of profiler</param> /// <returns></returns> public Profiler CreateInstance(ProfilerOptions options, string name) { var profiler = new Profiler(this, options, name); AddProfiler(profiler); return(profiler); }
public Profiler CreateInstanceWithPath(ProfilerOptions options, string name = null) { var stackTrace = new StackTrace(); var callingFrame = stackTrace.GetFrame(1); var callingMethod = callingFrame.GetMethod(); if (!callingMethod.IsStatic) { throw new Exception($"{nameof(Profiler)}() created from non-static. Creating profiler without name has huge overhead due to stack analysis. Only do so from static context so it minimizes number of times it is done."); } return(CreateInstance(options, callingMethod.DeclaringType.FullName + (name ?? ""))); }