12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- namespace SmartCoalApplication.SystemLayer
- {
- public static class Processor
- {
- private static int logicalCpuCount;
- static Processor()
- {
- logicalCpuCount = ConcreteLogicalCpuCount;
- }
- public static int LogicalCpuCount
- {
- get
- {
- return logicalCpuCount;
- }
- set
- {
- if (value < 1 || value > (IntPtr.Size * 8))
- {
- throw new ArgumentOutOfRangeException("value", value, "must be in the range [0, " + (IntPtr.Size * 8).ToString() + "]");
- }
- logicalCpuCount = value;
- }
- }
- public static int ConcreteLogicalCpuCount
- {
- get
- {
- return Environment.ProcessorCount;
- }
- }
- }
- }
|