Created
February 18, 2012 07:17
-
-
Save pandemicsyn/1857995 to your computer and use it in GitHub Desktop.
detectprocs.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env | |
| import os | |
| def proccount(): | |
| if hasattr(os, 'sysconf'): | |
| if 'SC_NPROCESSORS_ONLN' in os.sysconf_names.keys(): | |
| return os.sysconf("SC_NPROCESSORS_ONLN") | |
| else: | |
| return None | |
| print "Found %s active procs/cores" % proccount() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ ssh 10.0.1.3
Last login: Sat Feb 18 07:03:21 2012 from guest-10_0_1_10
OpenIndiana (powered by illumos) SunOS 5.11 oi_151a September 2011
$ python
Python 2.6.4 (r264:75706, Apr 17 2011, 11:24:50) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.