Click here to Skip to main content
15,900,907 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Encryption Algorithm Pin
Ed.Poore16-Nov-06 22:13
Ed.Poore16-Nov-06 22:13 
GeneralRe: Encryption Algorithm Pin
Galatei21-Nov-06 22:47
Galatei21-Nov-06 22:47 
AnswerRe: Encryption Algorithm Pin
A.A.5-Dec-06 4:08
A.A.5-Dec-06 4:08 
GeneralRe: Encryption Algorithm Pin
Dan Neely5-Dec-06 5:00
Dan Neely5-Dec-06 5:00 
GeneralRe: Encryption Algorithm Pin
A.A.5-Dec-06 5:35
A.A.5-Dec-06 5:35 
AnswerRe: Encryption Algorithm Pin
PICguy4-Jan-07 15:08
PICguy4-Jan-07 15:08 
QuestionMeasuring CPU usage ( from ticks to %) Pin
krystian_pl13-Nov-06 2:12
krystian_pl13-Nov-06 2:12 
AnswerRe: Measuring CPU usage ( from ticks to %) Pin
krystian_pl14-Nov-06 20:33
krystian_pl14-Nov-06 20:33 
ok, nobody answered and i did the job ;]

Here's how:

First thing: kernel time is a sum of real kernel time and idle time, because of the fact, that cpu is always 'busy' - you can find Idle process in Windows Task Manager. So to get actual kernel cpu usage You will have to do: kf - idf.

Second thing: You can't count it just like that. GetSystemTimes gives You time spent on kernel/idle/user processes from the start of You system. So You have to get one time, wait like 100ms and get second time. Then substract the first from the second to get a delta.
You don't have to substract the miliseconds from the delta, because each of them's got it added, and You only count percentage.

Let's say that:
uf : user cpu time delta
kf : kernel cpu time delta
idf : idle cpu time delta

and now:
to get percent of cpu user time, You have to:
(uf / (idf + (kf - idf) + uf))*100
to get percent of cpu kernel time, You have to:
((kf - idf) / (idf + uf + (kf - idf)))*100
and the last thing, idle time:
(idf / (uf + (kf - idf) + idf))*100

Please note, that this is made on INT64, not on FILETIME that You will get from GetSystemTimes WinAPI function - You have to cast it properly.

Best regards,
Krystian
GeneralRe: Measuring CPU usage ( from ticks to %) Pin
ejuanpp14-Nov-06 21:36
ejuanpp14-Nov-06 21:36 
QuestionRe: Measuring CPU usage ( from ticks to %) Pin
David Crow5-Dec-06 5:26
David Crow5-Dec-06 5:26 
QuestionDivision Algorithm Pin
Bagaturia david13-Nov-06 0:06
Bagaturia david13-Nov-06 0:06 
AnswerRe: Division Algorithm Pin
Sebastian Schneider13-Nov-06 2:05
Sebastian Schneider13-Nov-06 2:05 
GeneralRe: Division Algorithm Pin
Sebastian Schneider13-Nov-06 2:07
Sebastian Schneider13-Nov-06 2:07 
QuestionRe: Division Algorithm Pin
Are Jay21-Nov-06 17:39
Are Jay21-Nov-06 17:39 
AnswerRe: Division Algorithm Pin
Bagaturia david22-Nov-06 0:44
Bagaturia david22-Nov-06 0:44 
GeneralRe: Division Algorithm Pin
Are Jay22-Nov-06 3:34
Are Jay22-Nov-06 3:34 
GeneralRe: Division Algorithm Pin
Are Jay24-Nov-06 21:28
Are Jay24-Nov-06 21:28 
AnswerRe: Division Algorithm Pin
djlove24-Nov-06 7:21
djlove24-Nov-06 7:21 
AnswerRe: Division Algorithm Pin
Dan21786-Dec-06 19:01
Dan21786-Dec-06 19:01 
Questionhelp me with binary search Pin
MaSTaMaRViN12-Nov-06 23:09
MaSTaMaRViN12-Nov-06 23:09 
AnswerRe: help me with binary search Pin
Tim Craig13-Nov-06 19:50
Tim Craig13-Nov-06 19:50 
AnswerRe: help me with binary search Pin
David Crow5-Dec-06 5:36
David Crow5-Dec-06 5:36 
GeneralRe: help me with binary search Pin
ricecake6-Dec-06 3:53
ricecake6-Dec-06 3:53 
GeneralWell and truly sorted Pin
intrepid_is12-Nov-06 5:58
intrepid_is12-Nov-06 5:58 
GeneralRe: Well and truly sorted Pin
peterchen12-Nov-06 8:14
peterchen12-Nov-06 8:14 

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.