Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
AnswerRe: HTML code to .TXT Pin
Daniel Bright4-Oct-05 11:20
Daniel Bright4-Oct-05 11:20 
Questionpopulating the dynamically generated textboxes on click of a dynamically generated button. Pin
shivanimatta4-Oct-05 7:15
shivanimatta4-Oct-05 7:15 
QuestionSimple 2*2 output to textbox from application Pin
james3774-Oct-05 7:13
james3774-Oct-05 7:13 
AnswerRe: Simple 2*2 output to textbox from application Pin
Dan Neely4-Oct-05 8:12
Dan Neely4-Oct-05 8:12 
GeneralRe: Simple 2*2 output to textbox from application Pin
james3774-Oct-05 8:52
james3774-Oct-05 8:52 
GeneralRe: Simple 2*2 output to textbox from application Pin
Dan Neely4-Oct-05 9:40
Dan Neely4-Oct-05 9:40 
QuestionDataGrid Edit Event Pin
Yoyosch4-Oct-05 7:09
Yoyosch4-Oct-05 7:09 
QuestionDatatable Adding Row Pin
SJR_14-Oct-05 6:59
SJR_14-Oct-05 6:59 
AnswerRe: Datatable Adding Row Pin
vineas4-Oct-05 11:37
vineas4-Oct-05 11:37 
QuestionC# Network Problem Pin
theDexter4-Oct-05 6:34
theDexter4-Oct-05 6:34 
AnswerRe: C# Network Problem Pin
mav.northwind4-Oct-05 7:04
mav.northwind4-Oct-05 7:04 
GeneralRe: C# Network Problem Pin
4-Oct-05 8:01
suss4-Oct-05 8:01 
GeneralRe: C# Network Problem Pin
theDexter4-Oct-05 9:07
theDexter4-Oct-05 9:07 
QuestionCPU Usage Pin
manojk_batra4-Oct-05 6:32
manojk_batra4-Oct-05 6:32 
AnswerRe: CPU Usage Pin
Heath Stewart4-Oct-05 10:53
protectorHeath Stewart4-Oct-05 10:53 
What type of CPU usage you want to check is important. You can browse the various performance counters and read their descriptions using the Server Explorer tab in Visual Studio - right-clicking on the perf counter you want and select Properties - or use perfmon.exe o NT-based Windows OSes.

An example of just getting values every .5 seconds follows:
using System;
using System.Diagnostics;
using System.Threading;
 
class Usage
{
  static void Main()
  {
    using (PerformanceCounter pc = new PerformanceCounter())
    {
      // Use a specific counter for all CPUs.
      pc.CategoryName = "Processor";
      pc.CounterName = "% User Time";
      pc.InstanceName = "_Total";
 
      Console.Error.WriteLine("Total % User Time:");
      Console.Error.WriteLine("Press any key to exit...");
 
      ThreadPool.QueueUserWorkItem(new WaitCallback(Count), pc);
      Console.Read();
 
      Console.Error.WriteLine("Done");
    }
  }
 
  static void Count(object state)
  {
    PerformanceCounter pc = state as PerformanceCounter;
    while (pc != null)
    {
      Console.WriteLine("{0,3:f2}%", pc.NextValue());
      Thread.Sleep(500);
    }
  }
}


This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft

[My Articles] [My Blog]
GeneralRe: CPU Usage Pin
manojk_batra4-Oct-05 18:04
manojk_batra4-Oct-05 18:04 
AnswerRe: CPU Usage Pin
Heath Stewart5-Oct-05 6:47
protectorHeath Stewart5-Oct-05 6:47 
QuestionDisplaying an owned form when main form is shown Pin
Luis Alonso Ramos4-Oct-05 5:11
Luis Alonso Ramos4-Oct-05 5:11 
AnswerSolved! Pin
Luis Alonso Ramos4-Oct-05 5:42
Luis Alonso Ramos4-Oct-05 5:42 
AnswerRe: Displaying an owned form when main form is shown Pin
mav.northwind4-Oct-05 7:07
mav.northwind4-Oct-05 7:07 
QuestionRemoting URI question ? Pin
Member 127995794-Oct-05 5:10
Member 127995794-Oct-05 5:10 
AnswerRe: Remoting URI question ? Pin
S. Senthil Kumar4-Oct-05 6:07
S. Senthil Kumar4-Oct-05 6:07 
QuestionAutocompletion Pin
PaulaM4-Oct-05 5:07
PaulaM4-Oct-05 5:07 
AnswerRe: Autocompletion Pin
Daniel Grunwald4-Oct-05 5:54
Daniel Grunwald4-Oct-05 5:54 
Questionwav file + c# Pin
g00fyman4-Oct-05 3:26
g00fyman4-Oct-05 3:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.