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:35:19 +0200
  • Message-id: <4BC43AD70200002900096B47@xxxxxxxxxxxxxxxxxxx>
On 4/13/2010 at 9:31, Marcus Meissner <meissner@xxxxxxx> wrote:
On Tue, Apr 13, 2010 at 09:30:13AM +0200, Stephan Kulow wrote:
Am Montag, 12. April 2010 22:27:51 schrieb Jan Engelhardt:
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)
fi

That sounds wrong. This expression gives 10 on my single core machine.
And even with -d added to the ls, it still shows cpuidle there

echo /sys/devices/system/cpu/cpu*|wc -w

Still gives me for 4 as a result.

I stay with my suggestion from my other mail (if it needs to be changed):
ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l
This makes sure all the non cpu<num> directories like cpufreq and cpuidle are
excluded.

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

< Previous Next >
Follow Ups