bin/cpubench: support benchmarks setting

This commit is contained in:
2025-01-21 15:57:22 +08:00
parent 6db7d522d7
commit 89e0a70c6c
3 changed files with 6 additions and 4 deletions

View File

@@ -13,7 +13,7 @@
#=====================================================================
[common]
action = standard # options: standard, build, run, clean
benchmarks = IntSingle,FloatSingle
benchmarks = @@BENCHMARKS@@
#IntSingle
#benchmarks = x264,gcc,gzip,tpcc,tpch,velvet,openssl,rapidjson,python,xz

View File

@@ -55,6 +55,7 @@ const cpubenchConfig = cpubench.renderConfig({
...optimizeOptions({ optimize: argv.optimize as OptimizeOptions["optimize"] })
],
sysroot: argv.sysroot,
benchmarks: argv.benchmarks as cpubench.CPUBenchConfigOptions["benchmarks"],
});
const uuid = randomUUID();
@@ -70,7 +71,6 @@ const systemdArgs = [
path.resolve(cpubenchDir, 'cpubench.sh'),
`--config=${configFile}`,
"--skip_verify=1",
...argv.benchmarks.map(x => `-b=${x}`),
"--rebuild=1",
"-i=1"
];

View File

@@ -5,11 +5,13 @@ export interface CPUBenchConfigOptions {
llvmInstall: string;
optimize: string[];
sysroot: string;
benchmarks: string[];
}
export function renderConfig({ llvmInstall, optimize, sysroot }: CPUBenchConfigOptions) {
export function renderConfig({ llvmInstall, optimize, sysroot, benchmarks }: CPUBenchConfigOptions) {
return `# Rendered from TypeScript ${new Date().toLocaleString()}, do not edit!\n` + cpuBenchTemplate
.replace('@@LLVM_INSTALL@@', llvmInstall)
.replace('@@OPTIMIZE@@', optimize.join(' '))
.replace('@@SYSROOT@@', sysroot);
.replace('@@SYSROOT@@', sysroot)
.replace('@@BENCHMARKS@@', benchmarks.join(','));
}