commands/spec: add setprocgroup option

This commit is contained in:
2024-06-20 17:20:52 +08:00
parent 451deb78a7
commit b830b9922f

View File

@@ -1,20 +1,20 @@
import { optFlag, undefList } from "./common" import { optFlag, optSwitch, undefList } from "./common";
export interface RunCPUOptions { export interface RunCPUOptions {
/** /**
* Config file, used for compiling flags, compiler versions, etc. * Config file, used for compiling flags, compiler versions, etc.
*/ */
config?: string config?: string;
/** /**
* SPEC workload scale for each benchmark * SPEC workload scale for each benchmark
*/ */
workload?: "test" | "train" | "ref" workload?: "test" | "train" | "ref";
/** /**
* Selected benchmarks * Selected benchmarks
*/ */
benchmarks?: string[] benchmarks?: string[];
buildType?: "nobuild" | "rebuild" | "plain", buildType?: "nobuild" | "rebuild" | "plain",
@@ -49,6 +49,14 @@ export interface RunCPUOptions {
| "screen" | "screen"
/** Plain ASCII text file */ /** Plain ASCII text file */
| "text")[]; | "text")[];
/**
* Synonyms: none
* Default: --setprocgroup
* Meaning: Attempt to create all processes in a single group. Improves the chances that ^C will get the whole run, not just one of the children.
*/
setprocgroup?: boolean;
} }
export function runcpuOptions(o: RunCPUOptions): string[] { export function runcpuOptions(o: RunCPUOptions): string[] {
@@ -58,14 +66,15 @@ export function runcpuOptions(o: RunCPUOptions): string[] {
...undefList(o.buildType, opt => { ...undefList(o.buildType, opt => {
switch (opt) { switch (opt) {
case "nobuild": case "nobuild":
return ["--nobuild"] return ["--nobuild"];
case "rebuild": case "rebuild":
return ["--rebuild"] return ["--rebuild"];
case "plain": case "plain":
return [] return [];
} }
}), }),
...undefList(o.benchmarks, bench => bench), ...undefList(o.benchmarks, bench => bench),
...undefList(o.outputFormat, of => ["--output_format", of.join(",")]), ...undefList(o.outputFormat, of => ["--output_format", of.join(",")]),
] ...optSwitch("--setprocgroup", o.setprocgroup),
];
} }