mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Meta: Add get_number_of_processing_units() to shell_include.sh
This adds the method get_number_of_processing_units() which returns the number of processing units the system has available.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
449911c286
commit
36c892ae14
@@ -57,3 +57,18 @@ FUSE2FS_PATH="$(find_executable fuse2fs)"
|
||||
RESIZE2FS_PATH="$(find_executable resize2fs)"
|
||||
E2FSCK_PATH="$(find_executable e2fsck)"
|
||||
MKE2FS_PATH="$(find_executable mke2fs)"
|
||||
|
||||
get_number_of_processing_units() {
|
||||
number_of_processing_units="nproc"
|
||||
SYSTEM_NAME="$(uname -s)"
|
||||
|
||||
if [ "$SYSTEM_NAME" = "OpenBSD" ]; then
|
||||
number_of_processing_units="sysctl -n hw.ncpuonline"
|
||||
elif [ "$SYSTEM_NAME" = "FreeBSD" ]; then
|
||||
number_of_processing_units="sysctl -n hw.ncpu"
|
||||
elif [ "$SYSTEM_NAME" = "Darwin" ]; then
|
||||
number_of_processing_units="sysctl -n hw.ncpu"
|
||||
fi
|
||||
|
||||
($number_of_processing_units)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user