-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
135 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#if !NETSTANDARD2_0 | ||
#if NET6_0_OR_GREATER | ||
using System.Data; | ||
|
||
using FluentCommand; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#if !NETSTANDARD2_0 | ||
#if NET6_0_OR_GREATER | ||
using System.Data; | ||
|
||
using FluentCommand; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Diagnostics; | ||
|
||
namespace FluentCommand.Internal; | ||
|
||
internal readonly struct SharedStopwatch | ||
{ | ||
private static readonly Stopwatch _stopwatch = Stopwatch.StartNew(); | ||
|
||
private readonly TimeSpan _started; | ||
|
||
private SharedStopwatch(TimeSpan started) | ||
{ | ||
_started = started; | ||
} | ||
|
||
public TimeSpan Elapsed => _stopwatch.Elapsed - _started; | ||
|
||
public static SharedStopwatch StartNew() | ||
{ | ||
// This call to StartNewCore isn't required, but is included to avoid measurement errors | ||
// which can occur during periods of high allocation activity. In some cases, calls to Stopwatch | ||
// operations can block at their return point on the completion of a background GC operation. When | ||
// this occurs, the GC wait time ends up included in the measured time span. In the event the first | ||
// call to StartNewCore blocked on a GC operation, the second call will most likely occur when the | ||
// GC is no longer active. In practice, a substantial improvement to the consistency of analyzer | ||
// timing data was observed. | ||
// | ||
// Note that the call to SharedStopwatch.Elapsed is not affected, because the GC wait will occur | ||
// after the timer has already recorded its stop time. | ||
_ = StartNewCore(); | ||
return StartNewCore(); | ||
} | ||
|
||
private static SharedStopwatch StartNewCore() => new(_stopwatch.Elapsed); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters