This function is called quite option and hence we cache
the result to speed up code execution
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# #
###############################################################################
-_getconf() {
- getconf $@
-}
+SYSTEM_PROCESSORS=
# Returns the number of online processors
system_get_processors() {
- _getconf _NPROCESSORS_ONLN
+ # Cache this since the function is called quite often
+ isset SYSTEM_PROCESSORS || SYSTEM_PROCESSORS=$(__system_get_processors)
+
+ echo ${SYSTEM_PROCESSORS}
+}
+
+__system_get_processors() {
+ getconf _NPROCESSORS_ONLN
}
system_get_next_processor() {