mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03: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:
parent
449911c286
commit
36c892ae14
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/36c892ae14 Pull-request: https://github.com/SerenityOS/serenity/pull/18612 Reviewed-by: https://github.com/gmta ✅
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user