[bitbake-devel,7/9] command.py: add new API to get the cpu count on the server
Submitted by Dongxiao Xu on Feb. 23, 2012, 1:47 p.m.
|
Patch ID: 21711
Details
Commit Message
@@ -173,6 +173,12 @@ class CommandsSync:
"""
command.cooker.reset()
+ def getCpuCount(self, command, params):
+ """
+ Get the CPU count on the bitbake server
+ """
+ return bb.utils.cpu_count()
+
class CommandsAsync:
"""
@@ -25,6 +25,7 @@ import errno
import logging
import bb
import bb.msg
+import multiprocessing
from commands import getstatusoutput
from contextlib import contextmanager
@@ -862,3 +863,6 @@ def contains(variable, checkvalues, truevalue, falsevalue, d):
if checkvalues.issubset(val):
return truevalue
return falsevalue
+
+def cpu_count():
+ return multiprocessing.cpu_count()