Skip to content

cpu_percent() always returning 100% on osx #120

Closed
@giampaolo

Description

From jeffery....@gmail.com on October 22, 2010 23:08:04

My machine is essentially idle, but cpu_percent() always returns exactly 100%.

Here is copy/paste from terminal:

Python 2.6.1 ( r261 :67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.cpu_percent()
100.0
>>> What version of psutil are you using? On what operating system? using psutil-0.1.3

Installed from source. Used the command:
python setup.py install 
--prefix=${HOME}/Library/Frameworks/Python.framework/Versions/2.6 

Please provide any additional information below.  
Not sure if it helps, but here is the output from when I installed it:
ph-jeffkline-l01:psutil-0.1.3 kline$ python setup.py install 
--prefix=${HOME}/Library/Frameworks/Python.framework/Versions/2.6
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-universal-2.6
creating build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/__init__.py -> 
build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/_pslinux.py -> 
build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/_psmswindows.py -> 
build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/error.py -> build/lib.macosx-10.6-universal-2.6/psutil
copying psutil/wmi.py -> build/lib.macosx-10.6-universal-2.6/psutil
running build_ext
building '_psutil_osx' extension
creating build/temp.macosx-10.6-universal-2.6
creating build/temp.macosx-10.6-universal-2.6/psutil
creating build/temp.macosx-10.6-universal-2.6/psutil/arch
creating build/temp.macosx-10.6-universal-2.6/psutil/arch/osx
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv 
-Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc 
-arch x86_64 -pipe 
-I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
 -c psutil/_psutil_osx.c -o 
build/temp.macosx-10.6-universal-2.6/psutil/_psutil_osx.o
In file included from psutil/_psutil_osx.c:21:
/usr/include/mach/shared_memory_server.h:48:2: warning: #warning 
"<mach/shared_memory_server.h> is deprecated.  Please use 
<mach/shared_region.h> instead."
psutil/_psutil_osx.c: In function ‘pid_exists’:
psutil/_psutil_osx.c:182: warning: unused variable ‘idx’
psutil/_psutil_osx.c:181: warning: unused variable ‘num_processes’
psutil/_psutil_osx.c:180: warning: unused variable ‘procList’
psutil/_psutil_osx.c: In function ‘get_process_cpu_times’:
psutil/_psutil_osx.c:305: warning: unused variable ‘thread_list’
psutil/_psutil_osx.c:304: warning: unused variable ‘thread_count’
psutil/_psutil_osx.c:303: warning: unused variable ‘t_cpu’
psutil/_psutil_osx.c:302: warning: unused variable ‘t_stime_ms’
psutil/_psutil_osx.c:302: warning: unused variable ‘t_stime’
psutil/_psutil_osx.c:301: warning: unused variable ‘t_utime_ms’
psutil/_psutil_osx.c:301: warning: unused variable ‘t_utime’
psutil/_psutil_osx.c: In function ‘get_memory_info’:
psutil/_psutil_osx.c:451: warning: implicit declaration of function ‘vm_region_64’
psutil/_psutil_osx.c:418: warning: unused variable ‘system_time’
psutil/_psutil_osx.c:418: warning: unused variable ‘user_time’
psutil/_psutil_osx.c: In function ‘get_avail_phymem’:
psutil/_psutil_osx.c:512: warning: implicit declaration of function ‘host_statistics’
psutil/_psutil_osx.c:516: warning: implicit declaration of function ‘mach_error_string’
psutil/_psutil_osx.c:516: warning: format ‘&#37;s’ expects type ‘char 
*’, but argument 3 has type ‘int’
In file included from psutil/_psutil_osx.c:21:
/usr/include/mach/shared_memory_server.h:48:2: warning: #warning 
"<mach/shared_memory_server.h> is deprecated.  Please use 
<mach/shared_region.h> instead."
psutil/_psutil_osx.c: In function ‘pid_exists’:
psutil/_psutil_osx.c:182: warning: unused variable ‘idx’
psutil/_psutil_osx.c:181: warning: unused variable ‘num_processes’
psutil/_psutil_osx.c:180: warning: unused variable ‘procList’
psutil/_psutil_osx.c: In function ‘get_process_cpu_times’:
psutil/_psutil_osx.c:305: warning: unused variable ‘thread_list’
psutil/_psutil_osx.c:304: warning: unused variable ‘thread_count’
psutil/_psutil_osx.c:303: warning: unused variable ‘t_cpu’
psutil/_psutil_osx.c:302: warning: unused variable ‘t_stime_ms’
psutil/_psutil_osx.c:302: warning: unused variable ‘t_stime’
psutil/_psutil_osx.c:301: warning: unused variable ‘t_utime_ms’
psutil/_psutil_osx.c:301: warning: unused variable ‘t_utime’
psutil/_psutil_osx.c: In function ‘get_memory_info’:
psutil/_psutil_osx.c:451: warning: implicit declaration of function ‘vm_region_64’
psutil/_psutil_osx.c:418: warning: unused variable ‘system_time’
psutil/_psutil_osx.c:418: warning: unused variable ‘user_time’
psutil/_psutil_osx.c: In function ‘get_avail_phymem’:
psutil/_psutil_osx.c:512: warning: implicit declaration of function ‘host_statistics’
psutil/_psutil_osx.c:516: warning: implicit declaration of function ‘mach_error_string’
psutil/_psutil_osx.c:516: warning: format ‘&#37;s’ expects type ‘char 
*’, but argument 3 has type ‘int’
In file included from psutil/_psutil_osx.c:21:
/usr/include/mach/shared_memory_server.h:48:2: warning: #warning 
"<mach/shared_memory_server.h> is deprecated.  Please use 
<mach/shared_region.h> instead."
psutil/_psutil_osx.c: In function ‘pid_exists’:
psutil/_psutil_osx.c:182: warning: unused variable ‘idx’
psutil/_psutil_osx.c:181: warning: unused variable ‘num_processes’
psutil/_psutil_osx.c:180: warning: unused variable ‘procList’
psutil/_psutil_osx.c: In function ‘get_process_cpu_times’:
psutil/_psutil_osx.c:307: warning: cast from pointer to integer of different size
psutil/_psutil_osx.c:305: warning: unused variable ‘thread_list’
psutil/_psutil_osx.c:304: warning: unused variable ‘thread_count’
psutil/_psutil_osx.c:303: warning: unused variable ‘t_cpu’
psutil/_psutil_osx.c:302: warning: unused variable ‘t_stime_ms’
psutil/_psutil_osx.c:302: warning: unused variable ‘t_stime’
psutil/_psutil_osx.c:301: warning: unused variable ‘t_utime_ms’
psutil/_psutil_osx.c:301: warning: unused variable ‘t_utime’
psutil/_psutil_osx.c: In function ‘get_memory_info’:
psutil/_psutil_osx.c:417: warning: cast from pointer to integer of different size
psutil/_psutil_osx.c:451: warning: implicit declaration of function ‘vm_region_64’
psutil/_psutil_osx.c:418: warning: unused variable ‘system_time’
psutil/_psutil_osx.c:418: warning: unused variable ‘user_time’
psutil/_psutil_osx.c: In function ‘get_avail_phymem’:
psutil/_psutil_osx.c:512: warning: implicit declaration of function ‘host_statistics’
psutil/_psutil_osx.c:516: warning: implicit declaration of function ‘mach_error_string’
psutil/_psutil_osx.c:516: warning: format ‘&#37;s’ expects type ‘char 
*’, but argument 3 has type ‘int’
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv 
-Os -Wall -Wstrict-prototypes ...

Original issue: http://code.google.com/p/psutil/issues/detail?id=120

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions