Skip to content

Commit

Permalink
/proc/cpuinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
dkechag committed Sep 9, 2023
1 parent ef476ab commit af75044
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/MCE/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ sub get_ncpu {
OS_CHECK: {
local $_ = lc $^O;

/linux|android/ && do {
/linux/ && do {
my ( $count, $fh );
if ( open $fh, '<', '/proc/stat' ) {
$count = grep { /^cpu\d/ } <$fh>;
Expand Down Expand Up @@ -138,6 +138,16 @@ sub get_ncpu {
last OS_CHECK;
};

/android/ && do {
my ( $count, $fh );
if ( open $fh, '<', '/proc/cpuinfo' ) {
$count = grep { /^processor/ } <$fh>;
close $fh;
}
$ncpu = $count if $count;
last OS_CHECK;
};

warn "MCE::Util::get_ncpu: command failed or unknown operating system\n";
}

Expand Down

0 comments on commit af75044

Please sign in to comment.