logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Parse::DMIDecode::Examples - Examples using Parse::DMIDecode::Examples

Examples

Example1:FindtheNumberofPhysicalCPUs
        use strict;
        use Parse::DMIDecode qw();

        my $dmi = Parse::DMIDecode->new( nowarnings => 1 );
        $dmi->probe;

        my $physical_cpus = 0;
        for my $handle ($dmi->get_handles(group => "processor")) {
            my $type = ($handle->keyword("processor-type") or "");
            next unless $type =~ /Central Processor/i;

            # Check the status of the cpu
            my $status = ($handle->keyword("processor-status") or "");
            if ($status !~ /Unpopulated/i) {
                $physical_cpus++;
            }
        }

        printf("There %s %d physical %s in this machine.\n",
                ($physical_cpus == 1 ? "is" : "are"),
                $physical_cpus,
                ($physical_cpus == 1 ? "CPU" : "CPUs"),
            );

Name

       Parse::DMIDecode::Examples - Examples using Parse::DMIDecode::Examples

See Also