예제 #1
0
        public void TestBitArray()
        {
            var bitArray = new LoadTester.BitArray();

            bitArray.SetCount(sizeof(UInt32) * 8);
            Assert.AreEqual(bitArray.Value, ulong.MaxValue);

            for (int i = 0; i < bitArray.Count; i++)
            {
                bitArray[i] = false;
            }

            ulong value = bitArray.Value & UInt32.MaxValue;

            Assert.AreEqual(value, (ulong)0);

            bitArray[0] = true;
            value       = bitArray.Value & UInt32.MaxValue;
            Assert.AreEqual(value, (ulong)1);

            bitArray[0] = false;
            value       = bitArray.Value & UInt32.MaxValue;
            Assert.AreEqual(value, (ulong)0);


            bitArray[1] = true;
            value       = bitArray.Value & UInt32.MaxValue;
            Assert.AreEqual(value, (ulong)2);

            bitArray[1] = false;
        }
        public ProcessWrapper(IntPtr p_processHandle)
        {
            m_processHandle      = p_processHandle;
            ProcessAfinnityArray = new BitArray();
            ProcessAfinnityArray.SetCount(Environment.ProcessorCount);
            ProcessAfinnityArray.Changed += OnAfinnityChanged;

            UpdateBySystem();
        }
예제 #3
0
        public ThreadWrapper()
        {
            Speeds = new double[ThreadsManager.LastMeasurementsCount];
            for (int i = 0; i < ThreadsManager.LastMeasurementsCount; i++)
            {
                Speeds[i] = 0;
            }

            AfinnityArray = new BitArray();
            AfinnityArray.SetCount(Environment.ProcessorCount);
            AfinnityArray.Changed += OnAfinnityChanged;

            Reinit();

            Priority   = ThreadPriority.THREAD_PRIORITY_LOWEST;
            m_loadType = LoadType.Sleep;
            State      = ThreadState.Stopped;
            CreateNativeThread(true);
        }