Matrix Science header

config_procs.py

Determine computer processor information.

#!/usr/bin/python
##############################################################################
# file: config_procs.pl                                                      #
# 'msparser' toolkit example code                                            #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: /vol/cvsroot/parser/examples/test_python/config_procs.py,v $ #
#     $Author: neilr $                                                      #
#       $Date: 2016/03/22 10:13:16 $                                         #
#   $Revision: 1.3 $                                                         #
# $NoKeywords.                                                            $ #
##############################################################################

import msparser

# When running under Linux 2.4, don't set to 1 unless you are prepared to wait.
checkLinuxHT = 0
numLicensed = 1
cpus = msparser.ms_processors(checkLinuxHT, numLicensed)

if not cpus.isValid() :
    print("There are errors. Cannot continue. The last error description:")
    print(cpus.getLastErrorString())
    sys.exit(1)

print("Number of CPUS available on the system: %d" % cpus.getNumOnSystem())


"""

Running the program, for example with

python config_procs.pl

will give the following output (depending on the number of processors on your 
system):


Number of CPUS available on the system: 4


"""

Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50