Upgraded DisposableTimer to wrap the profiler... now we should really just use DisposableTimer for all profiling.
This commit is contained in:
@@ -7,7 +7,6 @@ namespace Umbraco.Core.Profiling
|
||||
/// </summary>
|
||||
internal interface IProfiler
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Render the UI to display the profiler
|
||||
/// </summary>
|
||||
@@ -18,7 +17,7 @@ namespace Umbraco.Core.Profiling
|
||||
string Render();
|
||||
|
||||
/// <summary>
|
||||
/// Profile a step
|
||||
/// Profile an operation
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
@@ -26,7 +25,7 @@ namespace Umbraco.Core.Profiling
|
||||
/// Use the 'using(' syntax
|
||||
/// </remarks>
|
||||
IDisposable Step(string name);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start the profiler
|
||||
/// </summary>
|
||||
|
||||
@@ -13,7 +13,23 @@ namespace Umbraco.Core.Profiling
|
||||
/// <returns></returns>
|
||||
internal static IDisposable Step<T>(this IProfiler profiler, string name)
|
||||
{
|
||||
return profiler.Step(string.Format(typeof(T).Name + ", " + name));
|
||||
if (profiler == null) throw new ArgumentNullException("profiler");
|
||||
return profiler.Step(typeof (T), name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes out a step prefixed with the type
|
||||
/// </summary>
|
||||
/// <param name="profiler"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
internal static IDisposable Step(this IProfiler profiler, Type objectType, string name)
|
||||
{
|
||||
if (profiler == null) throw new ArgumentNullException("profiler");
|
||||
if (objectType == null) throw new ArgumentNullException("objectType");
|
||||
if (name == null) throw new ArgumentNullException("name");
|
||||
return profiler.Step(string.Format("[{0}] {1}", objectType.Name, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,5 +33,7 @@ namespace Umbraco.Core.Profiling
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user