Patchwork utils: Add a cpu_count wrapper function

login
register
mail settings
Submitter Richard Purdie
Date Jan. 27, 2014, 2:38 p.m.
Message ID <1390833488.17424.252.camel@ted>
Download mbox | patch
Permalink /patch/65885/
State New
Headers show

Comments

Richard Purdie - Jan. 27, 2014, 2:38 p.m.
Add a cpu_count wrapper function (useful from annonymous python where
the import would be trickier).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
Otavio Salvador - Jan. 27, 2014, 4:44 p.m.
On Mon, Jan 27, 2014 at 12:38 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> Add a cpu_count wrapper function (useful from annonymous python where
> the import would be trickier).
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

Patch

diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 82987e8..36f82db 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -150,3 +150,7 @@  def trim_version(version, num_parts=2):
     parts = version.split(".")
     trimmed = ".".join(parts[:num_parts])
     return trimmed
+
+def cpu_count():
+    import multiprocessing
+    return multiprocessing.cpu_count()