Re: How to get Total cpu usage
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lsST5bWWjX1/M9YHC/sla9kAE83lHelR1oqtjckfJ9s=; b=LaMR1Zdg1HvJ7ZlD4r6bP4O0HkBb6bttzZaEetQVpxqbcTHY49F/HZLOuH+4vEF3Jj 9bEzpnxzX8V2TrltPi0sn8dwKa2P/4tr7fTZMiyACOUpIiWEoxWNHXpNoPZFDP+LcyJF 59sbh/0x5cTf9YDOx29xv24wXiuafc8SgefFI= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=CRSlYRAQGSjZX3MDG1u2U9NnrjNtf0OvNMJkdV0ecdASkcWVcM9TvHZBdtNwoY1EkT xxHOXIxrBYVjOzaOhW54qra6MiXhgSXxUHNNVUnwxGi+KOxCMzDdbzNtymwCOt+xxoae syxr/Nwe/HY5SLrusoHmGOEe2hJLOMGSaUHVI= Hi you did not make the effort to push your google button, basically something like the following snap but there are other options to estimate it for instance: - you could popen vm_stat - open "Activity Monitor" - you may also be able to list all proc with sysctl familly - getrusage now it's in your hands: to find the most significant average calculus uint32_t count; processor_cpu_load_info_t info; mach_msg_type_number_t message; kern_return_t status = host_processor_info( host, PROCESSOR_CPU_LOAD_INFO, &count, &info, &message ); do { // info[i].cpu_ticks[CPU_STATE_SYSTEM]; // info[i].cpu_ticks[CPU_STATE_USER]; // info[i].cpu_ticks[CPU_STATE_IDLE]; /* calculate your average */ } while (++i < count); PS: NOT A KERNEL QUESTION Best, On Wed, Jun 10, 2009 at 10:52 PM, Mathu kannan<mathueie@gmail.com> wrote:
Hi,
How to get Total cpu usage programmetically in MAC. Any API is there?
Regards, Mathu.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/0xcafefeed%40gmail.com
This email sent to 0xcafefeed@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
mm w