Skip to content

Commit

Permalink
Step methods: return Timing (more specific) rater than IDisposable
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCraver committed Feb 18, 2017
1 parent 32f0b34 commit e723bdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/MiniProfiler.Shared/MiniProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public MiniProfiler Clone()
}
#endif

internal IDisposable StepImpl(string name, decimal? minSaveMs = null, bool? includeChildrenWithMinSave = false)
internal Timing StepImpl(string name, decimal? minSaveMs = null, bool? includeChildrenWithMinSave = false)
{
return new Timing(this, Head, name, minSaveMs, includeChildrenWithMinSave);
}
Expand Down
14 changes: 7 additions & 7 deletions src/MiniProfiler.Shared/MiniProfilerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ public static T Inline<T>(this MiniProfiler profiler, Func<T> selector, string n
}

/// <summary>
/// Returns an <see cref="IDisposable"/> that will time the code between its creation and disposal.
/// Returns an <see cref="Timing"/> (<see cref="IDisposable"/>) that will time the code between its creation and disposal.
/// </summary>
/// <param name="profiler">The current profiling session or null.</param>
/// <param name="name">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param>
/// <param name="name">A descriptive name for the code that is encapsulated by the resulting Timing's lifetime.</param>
/// <returns>the profile step</returns>
public static IDisposable Step(this MiniProfiler profiler, string name) => profiler?.StepImpl(name);
public static Timing Step(this MiniProfiler profiler, string name) => profiler?.StepImpl(name);

/// <summary>
/// Returns an <see cref="IDisposable"/> that will time the code between its creation and disposal.
/// Returns an <see cref="Timing"/> (<see cref="IDisposable"/>) that will time the code between its creation and disposal.
/// Will only save the <see cref="Timing"/> if total time taken exceeds <paramref name="minSaveMs" />.
/// </summary>
/// <param name="profiler">The current profiling session or null.</param>
/// <param name="name">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param>
/// <param name="profiler">The current profiling session or <c>null</c>.</param>
/// <param name="name">A descriptive name for the code that is encapsulated by the resulting Timing's lifetime.</param>
/// <param name="minSaveMs">The minimum amount of time that needs to elapse in order for this result to be recorded.</param>
/// <param name="includeChildren">Should the amount of time spent in child timings be included when comparing total time
/// profiled with <paramref name="minSaveMs"/>? If true, will include children. If false will ignore children.</param>
/// <returns></returns>
/// <remarks>If <paramref name="includeChildren"/> is set to true and a child is removed due to its use of StepIf, then the
/// time spent in that time will also not count for the current StepIf calculation.</remarks>
public static IDisposable StepIf(this MiniProfiler profiler, string name, decimal minSaveMs, bool includeChildren = false)
public static Timing StepIf(this MiniProfiler profiler, string name, decimal minSaveMs, bool includeChildren = false)
{
return profiler?.StepImpl(name, minSaveMs, includeChildren);
}
Expand Down

0 comments on commit e723bdc

Please sign in to comment.