At 01:39 AM 11/27/2005 +0200, =?iso-8859-1?Q?Veli-Pekka_T=E4til=E4?= wrote: >Is there a module or some sample code that will let one find out the CPU >usage of a given process in percentages? This figure is highly useful and
There is no elementary process property of usage percentage. That has to be calculated. What CPU % is is the amount of cpu time used by the process in an interval divided by the total available cpu time in that interval. So say that one of the modules reported that a process used 900 milliseconds of cpu time in a 1 second period. .9 / 1 = 90% Note that the sampling interval is "real time" (wall clock time) and that that is not necessarily equal to the available cpu time for the said interval. Another way to look at is that there are a finite number of thread execution opportunities on a cpu during a given interval. The "usage" is how many of those opportunities the process used divided by the total number of opportunities. To explain it more deeply than that would be to get into how a cpu works and how threads execute in a squiggly mess of silicon. Get TaskInfo. That program tells u every last tidbit of information about ur system and the processes. U can see things like usage percentage, long term usage percentage, and grand total cpu time. The help file is quite informative as well. For further reading check out some sites about processor theory and design. If u know something about C check out the code for the program Top. What ur asking about is fundamentally a hardware question, not a software one. -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 00000100 _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
