summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index eb78c4a26..c70bff091 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -447,3 +447,9 @@ def is_bridge_member(interface):
return False, None
+def get_half_cpus():
+ """ return 1/2 of the numbers of available CPUs """
+ cpu = os.cpu_count()
+ if cpu > 1:
+ cpu /= 2
+ return int(cpu)