Probe::MachineInfo::NumCPUs - Number of CPUs


Probe-MachineInfo documentation Contained in the Probe-MachineInfo distribution.

Index


Code Index:

NAME

Top

Probe::MachineInfo::NumCPUs - Number of CPUs

SYNOPSIS

Top

blah

DESCRIPTION

Top

blah

PUBLIC INTERFACE

Top

get

 get()

Uses Unix::Processors to return the number of processors on the machine. If possible it returns the number of physical processors. If this is not possible on the particular operating system then returns the number of cpus online.

AUTHOR

Top

Sagar R. Shah


Probe-MachineInfo documentation Contained in the Probe-MachineInfo distribution.
package Probe::MachineInfo::NumCPUs;


# pragmata
use base qw(Probe::MachineInfo::Metric);
use strict;
use warnings;


# Standard Perl Library and CPAN modules
use English;
use Unix::Processors;

#
# CLASS ATTRIBUTES
#

#
# CONSTRUCTOR
#


sub get {
	my ($self) = @_;

	my $proc = Unix::Processors->new();
	my $num;
	eval {
		$num = $proc->max_physical;
	};
	if($@) {
		$num = $proc->max_online;
	}
	return $num;
}

1;