PerformanceCounter objMemperf = new PerformanceCounter("Memory","Available Bytes");
PerformanceCounter objProcperf = new PerformanceCounter("System", "Processes");
PerformanceCounter objComperf = new PerformanceCounter("System", "Threads");
Label1.Text = string.Format("{0:#,###}", objMemperf.NextValue()) + "Byte";
Label2.Text = objProcperf.NextValue().ToString();
Label3.Text = objComperf.NextValue().ToString();
if (!Page.IsPostBack)
{
foreach(PerformanceCounterCategory objPer in PerformanceCounterCategory.GetCategories())
{
ListBox1.Items.Add(new ListItem(objPer.CategoryName));
}
}