All pastes #100567 Raw Edit

Someone

public text v1 · immutable
#100567 ·published 2006-07-26 07:35 UTC
rendered paste body
        public void startCPUThread()
        {
            // First create the stack to hold the data from the cpu performance counter
            try
            {
                cpu_count = new PerfStack(cpu_max_interval); //new stack for CPU queue
            }
            catch (Exception e)
            {
                myLog.WriteEntry("Failed to create Perfstack:" + e.Message, System.Diagnostics.EventLogEntryType.Warning, 09001);
            }

            //Third start the thread for checking CPU Load 
            try
            {
                CPUThread cputhread = new CPUThread(this);
                th_cpu = new System.Threading.Thread(new System.Threading.ThreadStart(cputhread.runIt));
                th_cpu.Start();
                //if(MYDEBUG){ deb.WriteLine("THread started for CPU.");}
            }
            catch (Exception e)
            {
                myLog.WriteEntry("Exeption occured During start and instantiation of CPU_LOAD thread : " + e.Message, System.Diagnostics.EventLogEntryType.Error, 01009);
            }
        } // End startCPU 
	}//end class

    public class CPUThread
    {
        public System.Diagnostics.EventLog myLog2;
        React theparent = new React();
        /// <summary>
        /// this method is responsible for updating the stored conters with new data
        /// Runs every 5 seconds
        /// </summary>
        public CPUThread(React react)
        {
            theparent = react;
        }// end cpuThread method

        public void runIt()
        {
            myLog2 = new System.Diagnostics.EventLog();
            myLog2.Source = "React2";
            myLog2.Log = "Application";

            if (theparent != null)
            {
                myLog2.WriteEntry("ikke null", System.Diagnostics.EventLogEntryType.Error, 13001);
            }
            else
            {
                myLog2.WriteEntry("totalt null", System.Diagnostics.EventLogEntryType.Error, 13001);
            }

            while (true)
            {
                theparent.cpu_count.push(theparent.pc.mypc2.NextValue());
                System.Threading.Thread.Sleep(5000);
            }
        }
    } //end CPUThread class