File: utils.sh

package info (click to toggle)
0ad 0.28.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 182,352 kB
  • sloc: cpp: 201,989; javascript: 19,730; ansic: 15,057; python: 6,597; sh: 2,046; perl: 1,232; xml: 543; java: 533; makefile: 105
file content (13 lines) | stat: -rwxr-xr-x 306 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

# Collection of sh utilities

# Return number of online cpu or 1 if it can't be determined.
utils_num_online_cpu()
{
	getconf _NPROCESSORS_ONLN 2>/dev/null && return
	getconf NPROCESSORS_ONLN 2>/dev/null && return
	nproc 2>/dev/null && return
	sysctl -m hw.nproc 2>/dev/null && return
	echo 1
}