Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code Review feedback
  • Loading branch information
davmason committed May 9, 2023
commit fb6a4af99452f15f7fb620e106f613e97740883f
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void OnEventSourceCommand(object? sender, EventCommandEventArgs e)

lock (s_counterGroupLock) // Lock the CounterGroup
{
if (e.Command == EventCommand.Enable)
if (e.Command == EventCommand.Enable || e.Command == EventCommand.Update)
{
Debug.Assert(e.Arguments != null);

Expand All @@ -68,18 +68,9 @@ private void OnEventSourceCommand(object? sender, EventCommandEventArgs e)
return;
}

// Sending an Enabled with EventCounterIntervalSec <=0 is a signal that we should immediately turn
// off counters
if (intervalValue <= 0)
{
DisableTimer();
}
else
{
EnableTimer(intervalValue);
}
EnableTimer(intervalValue);
}
else
else if (e.Command == EventCommand.Disable)
{
Debug.Assert(e.Command == EventCommand.Disable);
// Since we allow sessions to send multiple Enable commands to update the interval, we cannot
Expand Down Expand Up @@ -158,7 +149,11 @@ private void EnableTimer(float pollingIntervalInSeconds)
{
Debug.Assert(pollingIntervalInSeconds > 0);
Debug.Assert(Monitor.IsEntered(s_counterGroupLock));
if (_pollingIntervalInMilliseconds == 0 || pollingIntervalInSeconds * 1000 < _pollingIntervalInMilliseconds)
if (pollingIntervalInSeconds <= 0)
{
DisableTimer();
}
else if (_pollingIntervalInMilliseconds == 0 || pollingIntervalInSeconds * 1000 < _pollingIntervalInMilliseconds)
{
_pollingIntervalInMilliseconds = (int)(pollingIntervalInSeconds * 1000);
ResetCounters(); // Reset statistics for counters before we start the thread.
Expand Down