Click here to Skip to main content
15,905,776 members
Home / Discussions / C#
   

C#

 
AnswerRe: formating numbers from strings Pin
Blue_Boy17-Sep-08 9:31
Blue_Boy17-Sep-08 9:31 
QuestionSoftware Design.. Whats your approach? Pin
JPWheeler17-Sep-08 3:53
JPWheeler17-Sep-08 3:53 
AnswerRe: Software Design.. Whats your approach? Pin
Scott Dorman17-Sep-08 4:41
professionalScott Dorman17-Sep-08 4:41 
AnswerRe: Software Design.. Whats your approach? Pin
PIEBALDconsult17-Sep-08 6:34
mvePIEBALDconsult17-Sep-08 6:34 
AnswerRe: Software Design.. Whats your approach? Pin
netJP12L17-Sep-08 7:33
netJP12L17-Sep-08 7:33 
AnswerRe: Software Design.. Whats your approach? Pin
Pete O'Hanlon17-Sep-08 9:20
mvePete O'Hanlon17-Sep-08 9:20 
QuestionHow to get the cpu percentage of a specific process using WMI with C# ? Pin
icks17-Sep-08 3:23
icks17-Sep-08 3:23 
AnswerRe: How to get the cpu percentage of a specific process using WMI with C# ? Pin
Mark Salsbery17-Sep-08 7:34
Mark Salsbery17-Sep-08 7:34 
I won't claim to know anything about this, but
based on the docs, I tried this (in a C# console app):
for (int i = 0; i < 100; i++)  // monitor for about 10 seconds
{
   ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT PercentProcessorTime FROM Win32_PerfFormattedData_PerfProc_Process WHERE Name = 'MFCTester'");
   ManagementObjectCollection.ManagementObjectEnumerator enumerator = searcher.Get().GetEnumerator();
   if (enumerator.MoveNext())
   {
      Console.WriteLine("MFCTester PercentProcessorTime: {0}", enumerator.Current["PercentProcessorTime"].ToString());
   }

   Thread.Sleep(100);
}

Seems to give the same results as the system monitor.

Notes:
My 'MFCTester' app is single threaded.
I forced CPU use by dragging it around the screen rapidly.
It looks like the result is the percentage of one processor - if I
divide the displayed percentages by 4 (the number of processors on my
system) I get the same values as the CPU column of the task manager.

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

JokeRe: How to get the cpu percentage of a specific process using WMI with C# ? Pin
DaveyM6917-Sep-08 9:40
professionalDaveyM6917-Sep-08 9:40 
GeneralRe: How to get the cpu percentage of a specific process using WMI with C# ? Pin
Mark Salsbery17-Sep-08 9:48
Mark Salsbery17-Sep-08 9:48 
GeneralRetrieving Text from Text Boxes Dynamically Generated at RunTime Pin
dboy22117-Sep-08 3:02
dboy22117-Sep-08 3:02 
Questionwindows service - timeout Pin
arkiboys17-Sep-08 2:48
arkiboys17-Sep-08 2:48 
AnswerRe: windows service - timeout Pin
PIEBALDconsult17-Sep-08 4:02
mvePIEBALDconsult17-Sep-08 4:02 
GeneralRe: windows service - timeout Pin
arkiboys17-Sep-08 21:27
arkiboys17-Sep-08 21:27 
GeneralRe: windows service - timeout Pin
PIEBALDconsult18-Sep-08 4:44
mvePIEBALDconsult18-Sep-08 4:44 
QuestionCSV File Pin
nhss17-Sep-08 2:33
nhss17-Sep-08 2:33 
AnswerRe: CSV File Pin
J4amieC17-Sep-08 2:38
J4amieC17-Sep-08 2:38 
JokeRe: CSV File Pin
Giorgi Dalakishvili17-Sep-08 2:51
mentorGiorgi Dalakishvili17-Sep-08 2:51 
GeneralRe: CSV File Pin
Scott Dorman17-Sep-08 3:09
professionalScott Dorman17-Sep-08 3:09 
GeneralRe: CSV File Pin
Muammar©17-Sep-08 3:20
Muammar©17-Sep-08 3:20 
GeneralRe: CSV File Pin
Ashfield17-Sep-08 3:40
Ashfield17-Sep-08 3:40 
AnswerRe: CSV File Pin
Mycroft Holmes17-Sep-08 20:00
professionalMycroft Holmes17-Sep-08 20:00 
QuestionHelp with unsafe code ( array of pointer to a stucture) [modified] Pin
Preetham.N17-Sep-08 2:24
Preetham.N17-Sep-08 2:24 
AnswerRe: Help with unsafe code ( array of pointer to a stucture) Pin
Alan Balkany17-Sep-08 3:23
Alan Balkany17-Sep-08 3:23 
GeneralRe: Help with unsafe code ( array of pointer to a stucture) Pin
Preetham.N17-Sep-08 3:30
Preetham.N17-Sep-08 3:30 

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.