Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-priv way to collect job stats under Intel?



1. system_cmds src ?
2. sysctl could give what u want

man 3 sysctl

-------------------------------------
	int mib[2], freq;
	u_int miblen = 2;
	size_t len;
	float speed;
	char *u;
	
	mib[0] = CTL_HW ;
	mib[1] = HW_CPU_FREQ ;
		
	len = sizeof(freq);
	
	if (sysctl(mib, miblen, &freq, &len, NULL, 0) == -1)
	{
		//err
	}
-------------------------------------
	int i, mib[4];
           size_t len;
           struct kinfo_proc kp;

           /* Fill out the first three components of the mib */
           len = 4;
           sysctlnametomib("kern.proc.pid", mib, &len);

           /* Fetch and print entries for pid's < 100 */
           for (i = 0; i < 100; i++) {
                   mib[3] = i;
                   len = sizeof(kp);
                   if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
                           perror("sysctl");
                   else if (len > 0)
                           printkproc(&kp);
           }

Best Regards


_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >Re:Non-priv way to collect job stats under Intel? (From: Jeffrey Johnson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.