Matrix Science header

config_procs.cs

Determine computer processor information.

/*
##############################################################################
# file: config_modprocs.cs                                                   #
# 'msparser' toolkit example code                                            #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2015 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#    $Source: parser/examples/test_csharp/config_procs.cs $                                #
#     $Author: villek@matrixscience.com $                                                    #
#       $Date: 2018-07-30 16:23:53 +0100 $                                         #
#   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $                                                         #
# $NoKeywords::                                                            $ #
##############################################################################
*/
using System;
using matrix_science.msparser;

namespace MsParserExamples
{
    public class config_procs
    {
        public static void Main(string[] argv)
        {
            // Don't check for Linux hyperthreading
            ms_processors cpus = new ms_processors(false, 1);

            if (!cpus.isValid())
            {
                Console.WriteLine("There are errors.  Cannot continue.  The last error description:");
                Console.WriteLine(cpus.getLastErrorString());
                return;
            }
            Console.WriteLine("Number of CPUs available on the system: {0}", cpus.getNumOnSystem());
            
        }
    }
}

/*
Running the program as
config_procs.exe
On a dual core Microsoft Windows system with hyperthreading will give the following output:

Number of CPUs available on the system: 4
*/

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