Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Multi-core / multi-processor detection

Multi-core / multi-processor detection
Thread Tools
Fresh-Faced Recruit
Join Date: Dec 2006
Status: Offline
Reply With Quote
Dec 20, 2006, 04:03 AM
 
Hello!

I want to make a script or c++ program that detects next information regarding processors on MacOxS platforms:

- processor name
- processor frequency
- number of physical processors
- number of online /active physical processors
- number of cores per processor
- number of threads per processor

Thanks a lot
     
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Offline
Reply With Quote
Dec 20, 2006, 04:41 AM
 
Just let Apple System Profiler do the work for you.
I don't suffer from insanity, I enjoy every minute of it.
     
manty  (op)
Fresh-Faced Recruit
Join Date: Dec 2006
Status: Offline
Reply With Quote
Dec 20, 2006, 06:40 AM
 
I'm interesting, in some commands to get those infos.
     
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Offline
Reply With Quote
Dec 20, 2006, 07:31 AM
 
Just create an Apple Script using Script Editor (located in Applications/Apple Script). You can find the documentation to all Apple Script commands in the menu (Window > Library). Double click the app in question and all commands will be listed with syntax and a short explanation. If you cannot find System Profiler in the list of applications, add it by clicking in `+'.

The output will be a text document. With a little experience in shell scripts, it should be very easy to extract the information you need automatically.
I don't suffer from insanity, I enjoy every minute of it.
     
manty  (op)
Fresh-Faced Recruit
Join Date: Dec 2006
Status: Offline
Reply With Quote
Dec 20, 2006, 07:58 AM
 
I need only shell commands, to be run in terminal. I don't have 'graphical' access to machine.

Thanks
     
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Dec 20, 2006, 08:00 AM
 
Originally Posted by manty View Post
I need only shell commands, to be run in terminal. I don't have 'graphical' access to machine.

Thanks
sysctl hw
     
manty  (op)
Fresh-Faced Recruit
Join Date: Dec 2006
Status: Offline
Reply With Quote
Dec 20, 2006, 08:41 AM
 
Thanks a lot! sysctl hw. works good.

Does any of you have processors with multi-cores or more then one physical processor processor and can give me some example of this command out put?

Thanks!
     
Mac Elite
Join Date: Mar 2001
Location: Madison, WI
Status: Offline
Reply With Quote
Dec 20, 2006, 08:59 AM
 
Knock yourself out

Code:
hw.ncpu: 2 hw.byteorder: 1234 hw.memsize: 2147483648 hw.activecpu: 2 hw.physicalcpu: 2 hw.physicalcpu_max: 2 hw.logicalcpu: 2 hw.logicalcpu_max: 2 hw.cputype: 7 hw.cpusubtype: 4 hw.cpufamily: 1943433984 hw.cacheconfig: 2 1 2 0 0 0 0 0 0 0 hw.pagesize: 4096 hw.busfrequency: 664000000 hw.busfrequency_min: 664000000 hw.busfrequency_max: 664000000 hw.cpufrequency: 2000000000 hw.cpufrequency_min: 2000000000 hw.cpufrequency_max: 2000000000 hw.cachelinesize: 64 hw.l1icachesize: 32768 hw.l1dcachesize: 32768 hw.l2cachesize: 2097152 hw.tbfrequency: 1000000000 hw.optional.floatingpoint: 1 hw.optional.mmx: 1 hw.optional.sse: 1 hw.optional.sse2: 1 hw.optional.sse3: 1 hw.machine = i386 hw.model = MacBook1,1 hw.ncpu = 2 hw.byteorder = 1234 hw.physmem = 2147483648 hw.usermem = 1829044224 hw.pagesize = 4096 hw.epoch = 0 hw.vectorunit = 1 hw.busfrequency = 664000000 hw.cpufrequency = 2000000000 hw.cachelinesize = 64 hw.l1icachesize = 32768 hw.l1dcachesize = 32768 hw.l2settings = 1 hw.l2cachesize = 2097152 hw.tbfrequency = 1000000000 hw.memsize = 2147483648 hw.availcpu = 2
I do not like those green links and spam.
I do not like them, Sam I am.
     
Professional Poster
Join Date: Jun 2006
Location: "Working"
Status: Offline
Reply With Quote
Dec 20, 2006, 09:10 AM
 
iMac CD 2.0/2GB
Code:
hw.ncpu: 2 hw.byteorder: 1234 hw.memsize: 2147483648 hw.activecpu: 2 hw.physicalcpu: 2 hw.physicalcpu_max: 2 hw.logicalcpu: 2 hw.logicalcpu_max: 2 hw.cputype: 7 hw.cpusubtype: 4 hw.cpufamily: 1943433984 hw.cacheconfig: 2 1 2 0 0 0 0 0 0 0 hw.pagesize: 4096 hw.busfrequency: 664000000 hw.busfrequency_min: 664000000 hw.busfrequency_max: 664000000 hw.cpufrequency: 2000000000 hw.cpufrequency_min: 2000000000 hw.cpufrequency_max: 2000000000 hw.cachelinesize: 64 hw.l1icachesize: 32768 hw.l1dcachesize: 32768 hw.l2cachesize: 2097152 hw.tbfrequency: 1000000000 hw.optional.floatingpoint: 1 hw.optional.mmx: 1 hw.optional.sse: 1 hw.optional.sse2: 1 hw.optional.sse3: 1 hw.machine = i386 hw.model = iMac4,1 hw.ncpu = 2 hw.byteorder = 1234 hw.physmem = 2147483648 hw.usermem = 1969065984 hw.pagesize = 4096 hw.epoch = 0 hw.vectorunit = 1 hw.busfrequency = 664000000 hw.cpufrequency = 2000000000 hw.cachelinesize = 64 hw.l1icachesize = 32768 hw.l1dcachesize = 32768 hw.l2settings = 1 hw.l2cachesize = 2097152 hw.tbfrequency = 1000000000 hw.memsize = 2147483648 hw.availcpu = 2
     
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Offline
Reply With Quote
Dec 20, 2006, 09:14 AM
 
Originally Posted by manty View Post
I need only shell commands, to be run in terminal. I don't have 'graphical' access to machine.
You can run Apple Scripts from the command line just fine.
I don't suffer from insanity, I enjoy every minute of it.
     
manty  (op)
Fresh-Faced Recruit
Join Date: Dec 2006
Status: Offline
Reply With Quote
Jan 11, 2007, 08:20 AM
 
Hi,

I come back with a question regarding same subject.

Between hw.machine and hw.model which one is the name of processor. I think none of those it is, or i'm wrong.

I also did next to get processor name:

ioreg -l | grep -B20 -A20 -i 'device_type.*cpu' | grep -i \\\"name\\\" | sed 's/!.*//g' | sed 's/.*=//g' | sed 's/[<>\"]//g'

Anyone else have another ideas?

Thanks a lot
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:57 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2