Show code - CODE/C-sharp/CpuMonitor.cs


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace CpuMonitor
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label lblInterruptsSec;
private System.Windows.Forms.Label lblDPCsQueuedSec;
private System.Windows.Forms.Label lblDPCRate;
private System.Windows.Forms.Label lblC3TransitionsSec;
private System.Windows.Forms.Label lblC2TransitionsSec;
private System.Windows.Forms.Label lblC1TransitionsSec;
private System.Windows.Forms.Label lblUserTime;
private System.Windows.Forms.Label lblProcessorTime;
private System.Windows.Forms.Label lblPrivilegedTime;
private System.Windows.Forms.Label lblInterruptTime;
private System.Windows.Forms.Label lblIdleTime;
private System.Windows.Forms.Label lblDPCTime;
private System.Windows.Forms.Label lblC3Time;
private System.Windows.Forms.Label lblC2Time;
private System.Windows.Forms.Label lblC1Time;
private System.Diagnostics.PerformanceCounter pCtrC1Time;
private System.Diagnostics.PerformanceCounter pCtrC2Time;
private System.Diagnostics.PerformanceCounter pCtrC3Time;
private System.Diagnostics.PerformanceCounter pCtrDPCTime;
private System.Diagnostics.PerformanceCounter pCtrIdleTime;
private System.Diagnostics.PerformanceCounter pCtrInterruptTime;
private System.Diagnostics.PerformanceCounter pCtrPrivilegedTime;
private System.Diagnostics.PerformanceCounter pCtrProcessorTime;
private System.Diagnostics.PerformanceCounter pCtrUserTime;
private System.Diagnostics.PerformanceCounter pCtrC1TransitionsSec;
private System.Diagnostics.PerformanceCounter pCtrC2TransitionsSec;
private System.Diagnostics.PerformanceCounter pCtrC3TransitionsSec;
private System.Diagnostics.PerformanceCounter pCtrDPCRate;
private System.Diagnostics.PerformanceCounter pCtrDPCsQueuedSec;
private System.Diagnostics.PerformanceCounter pCtrInerruptsSec;
private System.Timers.Timer timer1;
private System.Windows.Forms.Label lblTimerInterval;
private System.Windows.Forms.Label label17;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.lblInterruptsSec = new System.Windows.Forms.Label();
this.lblDPCsQueuedSec = new System.Windows.Forms.Label();
this.lblDPCRate = new System.Windows.Forms.Label();
this.lblC3TransitionsSec = new System.Windows.Forms.Label();
this.lblC2TransitionsSec = new System.Windows.Forms.Label();
this.lblC1TransitionsSec = new System.Windows.Forms.Label();
this.lblUserTime = new System.Windows.Forms.Label();
this.lblProcessorTime = new System.Windows.Forms.Label();
this.lblPrivilegedTime = new System.Windows.Forms.Label();
this.lblInterruptTime = new System.Windows.Forms.Label();
this.lblIdleTime = new System.Windows.Forms.Label();
this.lblDPCTime = new System.Windows.Forms.Label();
this.lblC3Time = new System.Windows.Forms.Label();
this.lblC2Time = new System.Windows.Forms.Label();
this.lblC1Time = new System.Windows.Forms.Label();
this.pCtrC1Time = new System.Diagnostics.PerformanceCounter();
this.pCtrC2Time = new System.Diagnostics.PerformanceCounter();
this.pCtrC3Time = new System.Diagnostics.PerformanceCounter();
this.pCtrDPCTime = new System.Diagnostics.PerformanceCounter();
this.pCtrIdleTime = new System.Diagnostics.PerformanceCounter();
this.pCtrInterruptTime = new System.Diagnostics.PerformanceCounter();
this.pCtrPrivilegedTime = new System.Diagnostics.PerformanceCounter();
this.pCtrProcessorTime = new System.Diagnostics.PerformanceCounter();
this.pCtrUserTime = new System.Diagnostics.PerformanceCounter();
this.pCtrC1TransitionsSec = new System.Diagnostics.PerformanceCounter();
this.pCtrC2TransitionsSec = new System.Diagnostics.PerformanceCounter();
this.pCtrC3TransitionsSec = new System.Diagnostics.PerformanceCounter();
this.pCtrDPCRate = new System.Diagnostics.PerformanceCounter();
this.pCtrDPCsQueuedSec = new System.Diagnostics.PerformanceCounter();
this.pCtrInerruptsSec = new System.Diagnostics.PerformanceCounter();
this.timer1 = new System.Timers.Timer();
this.lblTimerInterval = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pCtrC1Time)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC2Time)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC3Time)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrDPCTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrIdleTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrInterruptTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrPrivilegedTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrProcessorTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrUserTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC1TransitionsSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC2TransitionsSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC3TransitionsSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrDPCRate)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrDPCsQueuedSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrInerruptsSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.lblTimerInterval);
this.groupBox1.Controls.Add(this.label17);
this.groupBox1.Controls.Add(this.lblInterruptsSec);
this.groupBox1.Controls.Add(this.lblDPCsQueuedSec);
this.groupBox1.Controls.Add(this.lblDPCRate);
this.groupBox1.Controls.Add(this.lblC3TransitionsSec);
this.groupBox1.Controls.Add(this.lblC2TransitionsSec);
this.groupBox1.Controls.Add(this.lblC1TransitionsSec);
this.groupBox1.Controls.Add(this.lblUserTime);
this.groupBox1.Controls.Add(this.lblProcessorTime);
this.groupBox1.Controls.Add(this.lblPrivilegedTime);
this.groupBox1.Controls.Add(this.lblInterruptTime);
this.groupBox1.Controls.Add(this.lblIdleTime);
this.groupBox1.Controls.Add(this.lblDPCTime);
this.groupBox1.Controls.Add(this.lblC3Time);
this.groupBox1.Controls.Add(this.lblC2Time);
this.groupBox1.Controls.Add(this.lblC1Time);
this.groupBox1.Controls.Add(this.label15);
this.groupBox1.Controls.Add(this.label14);
this.groupBox1.Controls.Add(this.label13);
this.groupBox1.Controls.Add(this.label12);
this.groupBox1.Controls.Add(this.label11);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(280, 424);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "CPU";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(120, 16);
this.label1.TabIndex = 0;
this.label1.Text = "% C1 Time";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(120, 16);
this.label2.TabIndex = 1;
this.label2.Text = "% C2 Time";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 64);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(120, 16);
this.label3.TabIndex = 2;
this.label3.Text = "% C3 Time";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 88);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(120, 16);
this.label4.TabIndex = 3;
this.label4.Text = "% DPC Time";
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 112);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(120, 16);
this.label5.TabIndex = 4;
this.label5.Text = "% Idle Time";
//
// label6
//
this.label6.Location = new System.Drawing.Point(8, 136);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(120, 16);
this.label6.TabIndex = 5;
this.label6.Text = "% Interrupt Time";
//
// label7
//
this.label7.Location = new System.Drawing.Point(8, 160);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(120, 16);
this.label7.TabIndex = 6;
this.label7.Text = "% Privileged Time";
//
// label8
//
this.label8.Location = new System.Drawing.Point(8, 184);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(120, 16);
this.label8.TabIndex = 7;
this.label8.Text = "% Processor Time";
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 208);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(120, 16);
this.label9.TabIndex = 8;
this.label9.Text = "% User Time";
//
// label10
//
this.label10.Location = new System.Drawing.Point(8, 232);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(120, 16);
this.label10.TabIndex = 9;
this.label10.Text = "C1 Transitions/sec";
//
// label11
//
this.label11.Location = new System.Drawing.Point(8, 256);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(120, 16);
this.label11.TabIndex = 10;
this.label11.Text = "C2 Transitions/sec";
//
// label12
//
this.label12.Location = new System.Drawing.Point(8, 280);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(120, 16);
this.label12.TabIndex = 11;
this.label12.Text = "C3 Transitions/sec";
//
// label13
//
this.label13.Location = new System.Drawing.Point(8, 304);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(120, 16);
this.label13.TabIndex = 12;
this.label13.Text = "DPC Rate";
//
// label14
//
this.label14.Location = new System.Drawing.Point(8, 328);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(120, 16);
this.label14.TabIndex = 13;
this.label14.Text = "DPCs Queued/sec";
//
// label15
//
this.label15.Location = new System.Drawing.Point(8, 352);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(120, 16);
this.label15.TabIndex = 14;
this.label15.Text = "Interrupts/sec";
//
// lblInterruptsSec
//
this.lblInterruptsSec.Location = new System.Drawing.Point(144, 352);
this.lblInterruptsSec.Name = "lblInterruptsSec";
this.lblInterruptsSec.Size = new System.Drawing.Size(120, 16);
this.lblInterruptsSec.TabIndex = 29;
//
// lblDPCsQueuedSec
//
this.lblDPCsQueuedSec.Location = new System.Drawing.Point(144, 328);
this.lblDPCsQueuedSec.Name = "lblDPCsQueuedSec";
this.lblDPCsQueuedSec.Size = new System.Drawing.Size(120, 16);
this.lblDPCsQueuedSec.TabIndex = 28;
//
// lblDPCRate
//
this.lblDPCRate.Location = new System.Drawing.Point(144, 304);
this.lblDPCRate.Name = "lblDPCRate";
this.lblDPCRate.Size = new System.Drawing.Size(120, 16);
this.lblDPCRate.TabIndex = 27;
//
// lblC3TransitionsSec
//
this.lblC3TransitionsSec.Location = new System.Drawing.Point(144, 280);
this.lblC3TransitionsSec.Name = "lblC3TransitionsSec";
this.lblC3TransitionsSec.Size = new System.Drawing.Size(120, 16);
this.lblC3TransitionsSec.TabIndex = 26;
//
// lblC2TransitionsSec
//
this.lblC2TransitionsSec.Location = new System.Drawing.Point(144, 256);
this.lblC2TransitionsSec.Name = "lblC2TransitionsSec";
this.lblC2TransitionsSec.Size = new System.Drawing.Size(120, 16);
this.lblC2TransitionsSec.TabIndex = 25;
//
// lblC1TransitionsSec
//
this.lblC1TransitionsSec.Location = new System.Drawing.Point(144, 232);
this.lblC1TransitionsSec.Name = "lblC1TransitionsSec";
this.lblC1TransitionsSec.Size = new System.Drawing.Size(120, 16);
this.lblC1TransitionsSec.TabIndex = 24;
//
// lblUserTime
//
this.lblUserTime.Location = new System.Drawing.Point(144, 208);
this.lblUserTime.Name = "lblUserTime";
this.lblUserTime.Size = new System.Drawing.Size(120, 16);
this.lblUserTime.TabIndex = 23;
//
// lblProcessorTime
//
this.lblProcessorTime.Location = new System.Drawing.Point(144, 184);
this.lblProcessorTime.Name = "lblProcessorTime";
this.lblProcessorTime.Size = new System.Drawing.Size(120, 16);
this.lblProcessorTime.TabIndex = 22;
//
// lblPrivilegedTime
//
this.lblPrivilegedTime.Location = new System.Drawing.Point(144, 160);
this.lblPrivilegedTime.Name = "lblPrivilegedTime";
this.lblPrivilegedTime.Size = new System.Drawing.Size(120, 16);
this.lblPrivilegedTime.TabIndex = 21;
//
// lblInterruptTime
//
this.lblInterruptTime.Location = new System.Drawing.Point(144, 136);
this.lblInterruptTime.Name = "lblInterruptTime";
this.lblInterruptTime.Size = new System.Drawing.Size(120, 16);
this.lblInterruptTime.TabIndex = 20;
//
// lblIdleTime
//
this.lblIdleTime.Location = new System.Drawing.Point(144, 112);
this.lblIdleTime.Name = "lblIdleTime";
this.lblIdleTime.Size = new System.Drawing.Size(120, 16);
this.lblIdleTime.TabIndex = 19;
//
// lblDPCTime
//
this.lblDPCTime.Location = new System.Drawing.Point(144, 88);
this.lblDPCTime.Name = "lblDPCTime";
this.lblDPCTime.Size = new System.Drawing.Size(120, 16);
this.lblDPCTime.TabIndex = 18;
//
// lblC3Time
//
this.lblC3Time.Location = new System.Drawing.Point(144, 64);
this.lblC3Time.Name = "lblC3Time";
this.lblC3Time.Size = new System.Drawing.Size(120, 16);
this.lblC3Time.TabIndex = 17;
//
// lblC2Time
//
this.lblC2Time.Location = new System.Drawing.Point(144, 40);
this.lblC2Time.Name = "lblC2Time";
this.lblC2Time.Size = new System.Drawing.Size(120, 16);
this.lblC2Time.TabIndex = 16;
//
// lblC1Time
//
this.lblC1Time.Location = new System.Drawing.Point(144, 16);
this.lblC1Time.Name = "lblC1Time";
this.lblC1Time.Size = new System.Drawing.Size(120, 16);
this.lblC1Time.TabIndex = 15;
//
// pCtrC1Time
//
this.pCtrC1Time.CategoryName = "Processor";
this.pCtrC1Time.CounterName = "% C1 Time";
this.pCtrC1Time.InstanceName = "_Total";
this.pCtrC1Time.MachineName = "starlon";
//
// pCtrC2Time
//
this.pCtrC2Time.CategoryName = "Processor";
this.pCtrC2Time.CounterName = "% C2 Time";
this.pCtrC2Time.InstanceName = "_Total";
this.pCtrC2Time.MachineName = "starlon";
//
// pCtrC3Time
//
this.pCtrC3Time.CategoryName = "Processor";
this.pCtrC3Time.CounterName = "% C3 Time";
this.pCtrC3Time.InstanceName = "_Total";
this.pCtrC3Time.MachineName = "starlon";
//
// pCtrDPCTime
//
this.pCtrDPCTime.CategoryName = "Processor";
this.pCtrDPCTime.CounterName = "% DPC Time";
this.pCtrDPCTime.InstanceName = "_Total";
this.pCtrDPCTime.MachineName = "starlon";
//
// pCtrIdleTime
//
this.pCtrIdleTime.CategoryName = "Processor";
this.pCtrIdleTime.CounterName = "% Idle Time";
this.pCtrIdleTime.InstanceName = "_Total";
this.pCtrIdleTime.MachineName = "starlon";
//
// pCtrInterruptTime
//
this.pCtrInterruptTime.CategoryName = "Processor";
this.pCtrInterruptTime.CounterName = "% Interrupt Time";
this.pCtrInterruptTime.InstanceName = "_Total";
this.pCtrInterruptTime.MachineName = "starlon";
//
// pCtrPrivilegedTime
//
this.pCtrPrivilegedTime.CategoryName = "Processor";
this.pCtrPrivilegedTime.CounterName = "% Privileged Time";
this.pCtrPrivilegedTime.InstanceName = "_Total";
this.pCtrPrivilegedTime.MachineName = "starlon";
//
// pCtrProcessorTime
//
this.pCtrProcessorTime.CategoryName = "Processor";
this.pCtrProcessorTime.CounterName = "% Processor Time";
this.pCtrProcessorTime.InstanceName = "_Total";
this.pCtrProcessorTime.MachineName = "starlon";
//
// pCtrUserTime
//
this.pCtrUserTime.CategoryName = "Processor";
this.pCtrUserTime.CounterName = "% User Time";
this.pCtrUserTime.InstanceName = "_Total";
this.pCtrUserTime.MachineName = "starlon";
//
// pCtrC1TransitionsSec
//
this.pCtrC1TransitionsSec.CategoryName = "Processor";
this.pCtrC1TransitionsSec.CounterName = "C1 Transitions/sec";
this.pCtrC1TransitionsSec.InstanceName = "_Total";
this.pCtrC1TransitionsSec.MachineName = "starlon";
//
// pCtrC2TransitionsSec
//
this.pCtrC2TransitionsSec.CategoryName = "Processor";
this.pCtrC2TransitionsSec.CounterName = "C2 Transitions/sec";
this.pCtrC2TransitionsSec.InstanceName = "_Total";
this.pCtrC2TransitionsSec.MachineName = "starlon";
//
// pCtrC3TransitionsSec
//
this.pCtrC3TransitionsSec.CategoryName = "Processor";
this.pCtrC3TransitionsSec.CounterName = "C3 Transitions/sec";
this.pCtrC3TransitionsSec.InstanceName = "_Total";
this.pCtrC3TransitionsSec.MachineName = "starlon";
//
// pCtrDPCRate
//
this.pCtrDPCRate.CategoryName = "Processor";
this.pCtrDPCRate.CounterName = "DPC Rate";
this.pCtrDPCRate.InstanceName = "_Total";
this.pCtrDPCRate.MachineName = "starlon";
//
// pCtrDPCsQueuedSec
//
this.pCtrDPCsQueuedSec.CategoryName = "Processor";
this.pCtrDPCsQueuedSec.CounterName = "DPCs Queued/sec";
this.pCtrDPCsQueuedSec.InstanceName = "_Total";
this.pCtrDPCsQueuedSec.MachineName = "starlon";
//
// pCtrInerruptsSec
//
this.pCtrInerruptsSec.CategoryName = "Processor";
this.pCtrInerruptsSec.CounterName = "Interrupts/sec";
this.pCtrInerruptsSec.InstanceName = "_Total";
this.pCtrInerruptsSec.MachineName = "starlon";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.SynchronizingObject = this;
this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
//
// lblTimerInterval
//
this.lblTimerInterval.Location = new System.Drawing.Point(138, 400);
this.lblTimerInterval.Name = "lblTimerInterval";
this.lblTimerInterval.Size = new System.Drawing.Size(128, 16);
this.lblTimerInterval.TabIndex = 31;
//
// label17
//
this.label17.Location = new System.Drawing.Point(8, 400);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(120, 16);
this.label17.TabIndex = 30;
this.label17.Text = "Timer Interval";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(296, 438);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "CPU Monitor";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pCtrC1Time)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC2Time)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC3Time)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrDPCTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrIdleTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrInterruptTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrPrivilegedTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrProcessorTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrUserTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC1TransitionsSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC2TransitionsSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrC3TransitionsSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrDPCRate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrDPCsQueuedSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pCtrInerruptsSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private int timeInterval = 0;
private void Form1_Load(object sender, System.EventArgs e)
{
timer1.Start();
}
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
string c1Time = this.pCtrC1Time.NextValue().ToString();
string c1TransitionsSec = this.pCtrC1TransitionsSec.NextValue().ToString();
string c2Time = this.pCtrC2Time.NextValue().ToString();
string c2TransitionsSec = this.pCtrC2TransitionsSec.NextValue().ToString();
string c3Time = this.pCtrC3Time.NextValue().ToString();
string c3TransitionsSec = this.pCtrC3TransitionsSec.NextValue().ToString();
string dpcRate = this.pCtrDPCRate.NextValue().ToString();
string dpcsQueuedSec = this.pCtrDPCsQueuedSec.NextValue().ToString();
string dpcTime = this.pCtrDPCTime.NextValue().ToString();
string idleTime = this.pCtrIdleTime.NextValue().ToString();
string interruptsSec = this.pCtrInerruptsSec.NextValue().ToString();
string interruptTime = this.pCtrInterruptTime.NextValue().ToString();
string privilegedTime = this.pCtrPrivilegedTime.NextValue().ToString();
string processorTime = this.pCtrProcessorTime.NextValue().ToString();
this.lblC1Time.Text = c1Time;
this.lblC1TransitionsSec.Text = c1TransitionsSec;
this.lblC2Time.Text = c2Time;
this.lblC2TransitionsSec.Text = c2TransitionsSec;
this.lblC3Time.Text = c3Time;
this.lblC2TransitionsSec.Text = c2TransitionsSec;
this.lblDPCRate.Text = dpcRate;
this.lblDPCsQueuedSec.Text = dpcsQueuedSec;
this.lblDPCTime.Text = dpcTime;
this.lblIdleTime.Text = idleTime;
this.lblInterruptsSec.Text = interruptsSec;
this.lblInterruptTime.Text = interruptTime;
this.lblPrivilegedTime.Text = privilegedTime;
this.lblProcessorTime.Text = processorTime;
this.lblTimerInterval.Text = timeInterval.ToString();
timeInterval++;
this.lblTimerInterval.Text = timeInterval.ToString();
}
}
}