PDA

View Full Version : Getting System Information




buckyballs
Mar 12, 2009, 07:13 AM
Is there any simple way using Cocoa to obtain data such as the current battery level, CPU/Memory usage, HDD space etc?



autorelease
Mar 12, 2009, 04:06 PM
Is there any simple way using Cocoa to obtain data such as the current battery level, CPU/Memory usage, HDD space etc?

I'm pretty sure you have to ask the kernel, which means using the Mach API. Don't know of any Cocoa wrappers. You might want to try cracking open a widget like iStat Pro to see how it's done elsewhere.

lee1210
Mar 12, 2009, 04:10 PM
You don't have to hit the kernel directly... there are carbon functions for some of this... check out this thread, it might help get you started:
http://forums.macrumors.com/showthread.php?t=608084

-Lee

kainjow
Mar 12, 2009, 08:59 PM
Free space stuff can be done with Cocoa. The other things probably already have code examples on cocoadev.com - search there.