Skip to content

Commit

Permalink
Reset counters within Timer thread
Browse files Browse the repository at this point in the history
  • Loading branch information
eterekhin committed Jul 26, 2024
1 parent 81976ed commit 9c2156a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ private void EnableTimer(float pollingIntervalInSeconds)
if (_pollingIntervalInMilliseconds == 0 || pollingIntervalInSeconds * 1000 < _pollingIntervalInMilliseconds)
{
_pollingIntervalInMilliseconds = (int)(pollingIntervalInSeconds * 1000);
ResetCounters(); // Reset statistics for counters before we start the thread.

_timeStampSinceCollectionStarted = DateTime.UtcNow;
_nextPollingTimeStamp = DateTime.UtcNow + new TimeSpan(0, 0, (int)pollingIntervalInSeconds);
Expand Down Expand Up @@ -215,6 +214,7 @@ private void ResetCounters()

private void OnTimer()
{
ResetCounters();
if (_eventSource.IsEnabled())
{
DateTime now;
Expand Down

0 comments on commit 9c2156a

Please sign in to comment.