mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 17:44:48 +09:00
Co-authored-by: Ben Adams <thundercat@illyriad.co.uk>
This commit is contained in:
parent
b4b2c4653a
commit
cc8070c63e
2 changed files with 29 additions and 7 deletions
|
@ -185,8 +185,11 @@ namespace System.Threading
|
|||
// Add the current thread count and throughput sample to our history
|
||||
//
|
||||
double throughput = numCompletions / sampleDurationSeconds;
|
||||
|
||||
PortableThreadPoolEventSource.Log.WorkerThreadAdjustmentSample(throughput);
|
||||
PortableThreadPoolEventSource log = PortableThreadPoolEventSource.Log;
|
||||
if (log.IsEnabled())
|
||||
{
|
||||
log.WorkerThreadAdjustmentSample(throughput);
|
||||
}
|
||||
|
||||
int sampleIndex = (int)(_totalSamples % _samplesToMeasure);
|
||||
_samples[sampleIndex] = throughput;
|
||||
|
@ -356,8 +359,11 @@ namespace System.Threading
|
|||
// Record these numbers for posterity
|
||||
//
|
||||
|
||||
PortableThreadPoolEventSource.Log.WorkerThreadAdjustmentStats(sampleDurationSeconds, throughput, threadWaveComponent.Real, throughputWaveComponent.Real,
|
||||
if (log.IsEnabled())
|
||||
{
|
||||
log.WorkerThreadAdjustmentStats(sampleDurationSeconds, throughput, threadWaveComponent.Real, throughputWaveComponent.Real,
|
||||
throughputErrorEstimate, _averageThroughputNoise, ratio.Real, confidence, _currentControlSetting, (ushort)newThreadWaveMagnitude);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
@ -414,7 +420,11 @@ namespace System.Threading
|
|||
|
||||
_logSize++;
|
||||
|
||||
PortableThreadPoolEventSource.Log.WorkerThreadAdjustmentAdjustment(throughput, newThreadCount, (int)stateOrTransition);
|
||||
PortableThreadPoolEventSource log = PortableThreadPoolEventSource.Log;
|
||||
if (log.IsEnabled())
|
||||
{
|
||||
log.WorkerThreadAdjustmentAdjustment(throughput, newThreadCount, (int)stateOrTransition);
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceChange(int newThreadCount, StateOrTransition state)
|
||||
|
|
|
@ -26,7 +26,11 @@ namespace System.Threading
|
|||
|
||||
private static void WorkerThreadStart()
|
||||
{
|
||||
PortableThreadPoolEventSource.Log.WorkerThreadStart(ThreadCounts.VolatileReadCounts(ref ThreadPoolInstance._separated.counts).numExistingThreads);
|
||||
PortableThreadPoolEventSource log = PortableThreadPoolEventSource.Log;
|
||||
if (log.IsEnabled())
|
||||
{
|
||||
log.WorkerThreadStart(ThreadCounts.VolatileReadCounts(ref ThreadPoolInstance._separated.counts).numExistingThreads);
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -71,7 +75,11 @@ namespace System.Threading
|
|||
if (oldCounts == counts)
|
||||
{
|
||||
HillClimbing.ThreadPoolHillClimber.ForceChange(newCounts.numThreadsGoal, HillClimbing.StateOrTransition.ThreadTimedOut);
|
||||
PortableThreadPoolEventSource.Log.WorkerThreadStop(newCounts.numExistingThreads);
|
||||
|
||||
if (log.IsEnabled())
|
||||
{
|
||||
log.WorkerThreadStop(newCounts.numExistingThreads);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +97,11 @@ namespace System.Threading
|
|||
/// <returns>If this thread was woken up before it timed out.</returns>
|
||||
private static bool WaitForRequest()
|
||||
{
|
||||
PortableThreadPoolEventSource.Log.WorkerThreadWait(ThreadCounts.VolatileReadCounts(ref ThreadPoolInstance._separated.counts).numExistingThreads);
|
||||
PortableThreadPoolEventSource log = PortableThreadPoolEventSource.Log;
|
||||
if (log.IsEnabled())
|
||||
{
|
||||
log.WorkerThreadWait(ThreadCounts.VolatileReadCounts(ref ThreadPoolInstance._separated.counts).numExistingThreads);
|
||||
}
|
||||
return s_semaphore.Wait(ThreadPoolThreadTimeoutMs);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue