Beispiel #1
0
        public PerfTestSuite(Type testerType, string description, string featureDescription)
        {
            if (testerType==null)
                throw new ArgumentNullException("testerType");

            this.timeStamp = DateTime.Now;
            this.name = testerType.Name;
            this.description = description;
            this.featureDescription = featureDescription;
            this.tests = new PerfTestCollection();
            this.machine = PerfMachine.GetCurrent();
            this.os = PerfOs.GetCurrent();
        }
Beispiel #2
0
        /// <summary>
        /// Retreives system information about the machine.
        /// </summary>
        /// <returns>A <see cref="PerfMachine"/> object describing
        /// the physical configuration of the machine.
        /// </returns>
        /// <remarks>
        /// This method queries the register for physical information on the 
        /// system.
        /// </remarks>
        public static PerfMachine GetCurrent()
        {
            lock(typeof(PerfMachine))
            {
                PerfMachine machine = new PerfMachine();

                ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * From Win32_ComputerSystem");
                foreach(ManagementObject obj in query.Get())
                {
                    machine.Ram =long.Parse(obj["TotalPhysicalMemory"].ToString());
                    break;
                }

                query = new ManagementObjectSearcher("SELECT * From Win32_Processor");
                foreach(ManagementObject obj in query.Get())
                {
                    machine.Cpu =(string)obj["Name"];
                    machine.CpuHz =long.Parse(obj["CurrentClockSpeed"].ToString());
                    break;
                }

                return machine;
            }
        }