Popular recipes tagged "cpu_usage"http://code.activestate.com/recipes/tags/cpu_usage/2012-06-05T03:12:55-07:00ActiveState Code Recipesaffinity.py (Python) 2012-06-05T03:12:55-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578151-affinitypy/ <p style="color: grey"> Python recipe 578151 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/cpu_usage/">cpu_usage</a>, <a href="/recipes/tags/threadsafe/">threadsafe</a>). </p> <p>Allow a simple way to ensure execution is confined to one thread.</p> <p>This module defines the Affinity data type that runs code on a single thread. An instance of the class will execute functions only on the thread that made the object in the first place. The class is useful in a GUI's main loop.</p> CPU Usage Graph Applet (Java) 2010-03-26T01:12:44-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577145-cpu-usage-graph-applet/ <p style="color: grey"> Java recipe 577145 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/applet/">applet</a>, <a href="/recipes/tags/cpu_usage/">cpu_usage</a>, <a href="/recipes/tags/graphics/">graphics</a>). </p> <p>It calculates CPU speed w/o using any system calls etc. Instead it simply uses a timed counter.</p> Control CPU Usage by using ctypes (Win32 Platform) (Python) 2009-01-26T09:32:34-08:00Shao-chuan Wanghttp://code.activestate.com/recipes/users/4168519/http://code.activestate.com/recipes/576634-control-cpu-usage-by-using-ctypes-win32-platform/ <p style="color: grey"> Python recipe 576634 by <a href="/recipes/users/4168519/">Shao-chuan Wang</a> (<a href="/recipes/tags/cpu_usage/">cpu_usage</a>, <a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/system_programming/">system_programming</a>, <a href="/recipes/tags/win32/">win32</a>). Revision 3. </p> <p>This program will make your cpu work at a given cpu usage. It should be also able to work on machines with multi-processors. The program has been tested on Windows xp sp2 with python of version 2.5.4.</p> <p>The implementation is based on the fact that it will adjust the ratio of being busy over being idle in the main process to approach the target cpu usage rate. </p> Get CPU Usage by using ctypes (Win32 Platform) (Python) 2009-01-26T06:43:38-08:00Shao-chuan Wanghttp://code.activestate.com/recipes/users/4168519/http://code.activestate.com/recipes/576631-get-cpu-usage-by-using-ctypes-win32-platform/ <p style="color: grey"> Python recipe 576631 by <a href="/recipes/users/4168519/">Shao-chuan Wang</a> (<a href="/recipes/tags/cpu_usage/">cpu_usage</a>, <a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/system_programming/">system_programming</a>, <a href="/recipes/tags/win32/">win32</a>). Revision 2. </p> <p>The following code has been tested at Windows XP sp2 with Python of version 2.5.4.</p>