83 references to Throw
Microsoft.Extensions.Diagnostics.ResourceMonitoring (83)
CircularBuffer.cs (1)
17_ = Throw.IfLessThan(size, 1);
Linux\LinuxUtilizationParserCgroupV1.cs (15)
108Throw.InvalidOperationException($"Could not get cpu usage from '{_cpuacctUsage}'. Expected positive number, but got '{new string(usage)}'."); 128Throw.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(bufferWriter.Buffer.WrittenSpan)}'."); 144Throw.InvalidOperationException( 194Throw.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead."); 215Throw.InvalidOperationException($"Unable to find total_inactive_file from '{_memoryStat}'."); 223Throw.InvalidOperationException($"The value of total_inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'."); 236Throw.InvalidOperationException( 246Throw.InvalidOperationException($"The total memory usage read from '{_memoryUsageInBytes}' is lesser than inactive memory usage read from '{_memoryStat}'."); 265Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected first line of the file to start with '{MemTotal}' but it was '{new string(firstLine)}' instead."); 274Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get total memory usage on first line but we've got: '{new string(firstLine)}'."); 279Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get memory usage followed by the unit (kB, MB, GB) but found no unit: '{new string(firstLine)}'."); 364Throw.InvalidOperationException( 419Throw.InvalidOperationException($"Could not parse '{_cpuCfsQuotaUs}'. Expected an integer but got: '{new string(quotaBuffer)}'."); 437Throw.InvalidOperationException($"Could not parse '{_cpuCfsPeriodUs}'. Expected to get an integer but got: '{new string(periodBuffer)}'."); 467Throw.InvalidOperationException($"Could not parse '{_cpuPodWeight}' content. Expected to find CPU weight but got '{new string(cpuPodWeightBuffer)}' instead.");
Linux\LinuxUtilizationParserCgroupV2.cs (19)
115Throw.InvalidOperationException($"Could not parse '{_cpuacctUsage}'. We expected first line of the file to start with '{Usage_usec}' but it was '{new string(usage)}' instead."); 124Throw.InvalidOperationException($"Could not get cpu usage from '{_cpuacctUsage}'. Expected positive number, but got '{new string(usage)}'."); 146Throw.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(bufferWriter.Buffer.WrittenSpan)}'."); 162Throw.InvalidOperationException( 230Throw.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead."); 263Throw.InvalidOperationException( 301Throw.InvalidOperationException($"Unable to find inactive_file from '{_memoryStat}'."); 310Throw.InvalidOperationException($"The value of inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'."); 328Throw.InvalidOperationException($"The total memory usage read from '{_memoryUsageInBytes}' is lesser than inactive memory read from '{_memoryStat}'."); 347Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected first line of the file to start with '{MemTotal}' but it was '{new string(firstLine)}' instead."); 356Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get total memory usage on first line but we've got: '{new string(firstLine)}'."); 361Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get memory usage followed by the unit (kB, MB, GB) but found no unit: '{new string(firstLine)}'."); 446Throw.InvalidOperationException( 516Throw.InvalidOperationException($"Could not parse '{_cpuCfsQuaotaPeriodUs}'. Expected an integer but got: '{new string(quotaBuffer)}'."); 526Throw.InvalidOperationException($"Could not parse '{_cpuCfsQuaotaPeriodUs}'. Expected to get an integer but got: '{new string(cpuPeriodSlice)}'."); 551Throw.InvalidOperationException( 559Throw.InvalidOperationException( 565Throw.ArgumentOutOfRangeException("CPU weight", 592Throw.InvalidOperationException(
Linux\Network\LinuxNetworkUtilizationParser.cs (4)
80Throw.InvalidOperationException($"Could not split contents. We expected every line to contain more than {Target - 1} elements, but it has only {numRanges} elements."); 130Throw.IfOutOfRange(state); 147Throw.InvalidOperationException($"Could not parse '{file}'. File was empty."); 153Throw.InvalidOperationException($"Could not parse '{file}'. We expected first line of the file to start with '{Sl}' but it was '{firstLine.ToString()}' instead.");
ResourceMonitoringBuilderExtensions.cs (4)
28_ = Throw.IfNull(builder); 29_ = Throw.IfNull(configure); 45_ = Throw.IfNull(builder); 46_ = Throw.IfNull(section);
ResourceMonitoringServiceCollectionExtensions.cs (4)
34_ = Throw.IfNull(services); 50_ = Throw.IfNull(services); 51_ = Throw.IfNull(configure); 115_ = Throw.IfNull(builder);
ResourceMonitorService.cs (3)
73var optionsValue = Throw.IfMemberNull(options, options.Value); 90_ = Throw.IfLessThanOrEqual(window.Ticks, 0); 91_ = Throw.IfGreaterThan(window.Ticks, _collectionWindow.Ticks);
ResourceUtilization.cs (2)
65CpuUsedPercentage = Math.Min(Hundred, Throw.IfLessThan(cpuUsedPercentage / guaranteedCpuUnits, 0.0)); 66MemoryUsedInBytes = Throw.IfLessThan(memoryUsedInBytes, 0);
Snapshot.cs (6)
51_ = Throw.IfLessThan(memoryUsageInBytes, 0); 52_ = Throw.IfLessThan(kernelTimeSinceStart.Ticks, 0); 53_ = Throw.IfLessThan(userTimeSinceStart.Ticks, 0); 75_ = Throw.IfLessThan(memoryUsageInBytes, 0); 76_ = Throw.IfLessThan(kernelTimeSinceStart.Ticks, 0); 77_ = Throw.IfLessThan(userTimeSinceStart.Ticks, 0);
src\Shared\BufferWriterPool\BufferWriter.cs (4)
74_ = Throw.IfLessThan(value, 0); 121_ = Throw.IfOutOfRange(count, 0, _buffer.Length - WrittenCount); 182Throw.InvalidOperationException("Exceeded array capacity"); 189_ = Throw.IfLessThan(sizeHint, 0);
src\Shared\BufferWriterPool\BufferWriterPool.cs (2)
28_ = Throw.IfLessThan(maxCapacity, 1); 29_ = Throw.IfLessThan(maxBufferWriterCapacity, 1);
src\Shared\BufferWriterPool\BufferWriterPooledObjectPolicy.cs (2)
37MaximumRetainedCapacity = Throw.IfLessThan(maximumRetainedCapacity, 1); 63_ = Throw.IfNull(obj);
src\Shared\Data.Validation\TimeSpanAttribute.cs (3)
88_ = Throw.IfNullOrWhitespace(min); 101_ = Throw.IfNullOrWhitespace(min); 102_ = Throw.IfNullOrWhitespace(max);
src\Shared\Pools\PoolFactory.cs (10)
42_ = Throw.IfLessThan(maxCapacity, 1); 57_ = Throw.IfNull(policy); 58_ = Throw.IfLessThan(maxCapacity, 1); 75_ = Throw.IfLessThan(maxCapacity, 1); 88_ = Throw.IfLessThan(maxCapacity, 1); 89_ = Throw.IfLessThan(maxStringBuilderCapacity, 1); 116_ = Throw.IfLessThan(maxCapacity, 1); 136_ = Throw.IfLessThan(maxCapacity, 1); 155_ = Throw.IfLessThan(maxCapacity, 1); 177_ = Throw.IfLessThan(maxCapacity, 1);
SystemResources.cs (4)
57GuaranteedCpuUnits = Throw.IfLessThanOrEqual(guaranteedCpuUnits, 0.0); 58MaximumCpuUnits = Throw.IfLessThanOrEqual(maximumCpuUnits, 0.0); 59GuaranteedMemoryInBytes = Throw.IfLessThan(guaranteedMemoryInBytes, 1UL); 60MaximumMemoryInBytes = Throw.IfLessThan(maximumMemoryInBytes, 1UL);