Matrix Science header

config_procs.pl

Determine computer processor information.

#!/usr/local/bin/perl
##############################################################################
# file: config_procs.pl                                                      #
# 'msparser' toolkit example code                                            #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: parser/examples/test_perl/config_procs.pl $ #
#     $Author: villek@matrixscience.com $                                                      #
#       $Date: 2018-07-30 16:23:53 +0100 $                                         #
#   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $                                                         #
# $NoKeywords::                                                            $ #
##############################################################################
use strict;
##############################################################################

use msparser;

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

if (!$cpus->isValid) {
    print "There are errors. Cannot continue. The last error description:\n";
    print $cpus->getLastErrorString(), "\n";
    exit 1;
}

print "Number of CPUS available on the system: ", $cpus->getNumOnSystem(), "\n";


=pod

Running the program, for example with

perl -I../bin 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


=cut



Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29