Command line flag for changing number of threads
This commit is contained in:
parent
b7d785f0c8
commit
ddec4adf57
7
main.go
7
main.go
@ -11,7 +11,9 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
@ -130,6 +132,9 @@ func main() {
|
||||
pewDistFlag := pewCommand.Flag("dist", "Build result path")
|
||||
pewDist := pewDistFlag.Default(PATH_DEV_NULL).String()
|
||||
|
||||
pewThreadsFlag := pewCommand.Flag("threads", "Build result path")
|
||||
pewThreads := pewThreadsFlag.Default(strconv.Itoa(runtime.NumCPU())).Int()
|
||||
|
||||
kernelCommand := app.Command("kernel", "Manipulate kernels")
|
||||
kernelUseHost := kernelCommand.Flag("host", "Use also host kernels").Bool()
|
||||
kernelListCommand := kernelCommand.Command("list", "List kernels")
|
||||
@ -240,7 +245,7 @@ func main() {
|
||||
case pewCommand.FullCommand():
|
||||
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
|
||||
*pewTest, *pewGuess, *qemuTimeout, *dockerTimeout,
|
||||
*pewMax, *pewDist, db)
|
||||
*pewMax, *pewDist, *pewThreads, db)
|
||||
case kernelListCommand.FullCommand():
|
||||
err = kernelListHandler(kcfg)
|
||||
case kernelAutogenCommand.FullCommand():
|
||||
|
9
pew.go
9
pew.go
@ -15,7 +15,6 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -373,11 +372,11 @@ func shuffleKernels(a []config.KernelInfo) []config.KernelInfo {
|
||||
|
||||
func performCI(ka config.Artifact, kcfg config.KernelConfig, binaryPath,
|
||||
testPath string, qemuTimeout, dockerTimeout time.Duration,
|
||||
max int64, dist string, db *sql.DB) (err error) {
|
||||
max int64, dist string, threads int, db *sql.DB) (err error) {
|
||||
|
||||
found := false
|
||||
|
||||
swg := sizedwaitgroup.New(runtime.NumCPU())
|
||||
swg := sizedwaitgroup.New(threads)
|
||||
for _, kernel := range shuffleKernels(kcfg.Kernels) {
|
||||
if max <= 0 {
|
||||
break
|
||||
@ -448,7 +447,7 @@ func genAllKernels() (sk []config.KernelMask, err error) {
|
||||
func pewHandler(kcfg config.KernelConfig,
|
||||
workPath, ovrrdKrnl, binary, test string, guess bool,
|
||||
qemuTimeout, dockerTimeout time.Duration,
|
||||
max int64, dist string, db *sql.DB) (err error) {
|
||||
max int64, dist string, threads int, db *sql.DB) (err error) {
|
||||
|
||||
ka, err := config.ReadArtifactConfig(workPath + "/.out-of-tree.toml")
|
||||
if err != nil {
|
||||
@ -477,7 +476,7 @@ func pewHandler(kcfg config.KernelConfig,
|
||||
}
|
||||
|
||||
err = performCI(ka, kcfg, binary, test, qemuTimeout, dockerTimeout,
|
||||
max, dist, db)
|
||||
max, dist, threads, db)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user