Debian Codegraph @

scripts/count-cpus

raw symbols SCIP
1 #!/bin/sh
2
3 # Count processors in the system
4 #
5 # Copyright 2017 Robert Krawitz ([email protected])
6 #
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the Free
9 # Software Foundation; either version 2 of the License, or (at your option)
10 # any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
20 # Use explicit /bin/sh in the shebang line to allow this to work in
21 # a non-initialized workspace.
22
23 # User-specified value takes priority
24 if [ -n "$STP_PARALLEL" ] ; then
25 echo $STP_PARALLEL
26 exit 0
27 fi
28
29 # Linux
30 nproc=$(type -p nproc)
31 if [ -n "$nproc" ] ; then
32 nproc
33 else
34 echo 1
35 fi