Mailinglist Archive: opensuse-buildservice (348 mails)

< Previous Next >
Re: [opensuse-buildservice] [PATCH 2/6] obsworker: use sysfs instead to get number of CPUs
  • From: "Dominique Leuenberger" <Dominique.Leuenberger@xxxxxxxxxxxxx>
  • Date: Tue, 13 Apr 2010 09:13:52 +0200
  • Message-id: <4BC435D00200002900096B3D@xxxxxxxxxxxxxxxxxxx>
On 4/12/2010 at 22:27, Jan Engelhardt <jengelh@xxxxxxxxxx> wrote:
Grepping for ^processor in /proc/cpuinfo produces a zero result on
sparc64, so don't do it. Use sysfs instead.

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxx>
---
dist/obsworker | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dist/obsworker b/dist/obsworker
index d7a77c2..295f19c 100755
--- a/dist/obsworker
+++ b/dist/obsworker
@@ -151,7 +151,7 @@ case "$1" in
NUM="$OBS_WORKER_INSTANCES"
else
# start one build backend per CPU
- NUM=`grep -i ^processor /proc/cpuinfo | wc -l`
+ NUM=$(ls /sys/devices/system/cpu/cpu* | wc -l)

Are you sure that is supposed to be the same result?

Example:

dle3ams@3120-2914:~> grep -i ^processor /proc/cpuinfo | wc -l
2
dle3ams@3120-2914:~> ls /sys/devices/system/cpu/cpu* | wc -l
24

Dare to tell me where I got my other 22 CPUs from ? :)

At best you'd probably want something like:
ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l
if you really want to use sysfs in this way.

Dominique
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >