Click here to Skip to main content
16,004,050 members
Home / Discussions / C#
   

C#

 
AnswerRe: ListBox with Only Text & Background as Form Image Pin
Anand Todkar20-Jul-07 5:17
Anand Todkar20-Jul-07 5:17 
GeneralRe: ListBox with Only Text & Background as Form Image Pin
Sukhjinder_K20-Jul-07 6:59
Sukhjinder_K20-Jul-07 6:59 
QuestionRound Edge Labels or Custom Shape Pin
Sukhjinder_K20-Jul-07 3:40
Sukhjinder_K20-Jul-07 3:40 
AnswerRe: Round Edge Labels or Custom Shape Pin
Mircea Puiu20-Jul-07 3:51
Mircea Puiu20-Jul-07 3:51 
Questionresizing the controls in the panel at runtime Pin
Ashfaq Ali20-Jul-07 3:37
Ashfaq Ali20-Jul-07 3:37 
AnswerRe: resizing the controls in the panel at runtime Pin
originSH20-Jul-07 3:40
originSH20-Jul-07 3:40 
GeneralRe: resizing the controls in the panel at runtime Pin
Ashfaq Ali20-Jul-07 4:27
Ashfaq Ali20-Jul-07 4:27 
QuestionCPU Usage Monitoring Pin
Malcolm Smart20-Jul-07 3:33
Malcolm Smart20-Jul-07 3:33 
Hi
I need the "% Processor Time" counter from teh "Processor" category from the Performance counters...so I do this
System.Diagnostics.PerformanceCounter cpu = new System.Diagnostics.PerformanceCounter();
            cpu.CategoryName = "Processor";
            cpu.CounterName = "% Processor Time";
            cpu.InstanceName = "_Total";

            long rawValue = cpu.RawValue;  //gives value, but need %age
            float percentValue = cpu.NextValue(); //returns zero always

As the comments say, the cpu.NextValue() returns zero and the RawValue gives something like the following :-
Raw Usage : 919324765625
Raw Usage : 919329687500
Raw Usage : 919334453125


This is a dual processor machine, running constantly at about 50% (according to perfmon).

Any ideas why I can't get the %age value or how to convert raw value to a percentage?

Cheers

"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF

AnswerRe: CPU Usage Monitoring Pin
Malcolm Smart20-Jul-07 3:46
Malcolm Smart20-Jul-07 3:46 
GeneralRe: CPU Usage Monitoring Pin
Luc Pattyn20-Jul-07 3:58
sitebuilderLuc Pattyn20-Jul-07 3:58 
GeneralRe: CPU Usage Monitoring Pin
Malcolm Smart20-Jul-07 4:43
Malcolm Smart20-Jul-07 4:43 
JokeRe: CPU Usage Monitoring Pin
Luc Pattyn20-Jul-07 5:02
sitebuilderLuc Pattyn20-Jul-07 5:02 
JokeRe: CPU Usage Monitoring Pin
Paul Conrad20-Jul-07 5:47
professionalPaul Conrad20-Jul-07 5:47 
JokeRe: CPU Usage Monitoring Pin
Luc Pattyn20-Jul-07 6:02
sitebuilderLuc Pattyn20-Jul-07 6:02 
GeneralRe: CPU Usage Monitoring Pin
Paul Conrad20-Jul-07 6:14
professionalPaul Conrad20-Jul-07 6:14 
QuestionDrag & Drop trouble Pin
eskape1920-Jul-07 3:24
eskape1920-Jul-07 3:24 
AnswerRe: Drag & Drop trouble [modified] Pin
BoneSoft20-Jul-07 4:06
BoneSoft20-Jul-07 4:06 
AnswerRe: Drag & Drop trouble Pin
BoneSoft20-Jul-07 5:00
BoneSoft20-Jul-07 5:00 
Question(Exit) Not to continue the execution Pin
-spy-20-Jul-07 3:09
-spy-20-Jul-07 3:09 
AnswerRe: (Exit) Not to continue the execution Pin
Pete O'Hanlon20-Jul-07 3:15
mvePete O'Hanlon20-Jul-07 3:15 
AnswerRe: (Exit) Not to continue the execution Pin
Waleed Eissa29-Aug-07 10:15
Waleed Eissa29-Aug-07 10:15 
Questionsubstituting variables [modified] Pin
KPThor20-Jul-07 2:49
KPThor20-Jul-07 2:49 
AnswerRe: substituting variables Pin
Colin Angus Mackay20-Jul-07 2:53
Colin Angus Mackay20-Jul-07 2:53 
GeneralRe: substituting variables Pin
KPThor20-Jul-07 3:27
KPThor20-Jul-07 3:27 
GeneralRe: substituting variables Pin
Colin Angus Mackay20-Jul-07 4:16
Colin Angus Mackay20-Jul-07 4:16 

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.