From b4d03db52ed5fe2aaa4414c42b1c668d1eae3647 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Fri, 15 Aug 2025 15:24:32 +0800 Subject: [PATCH] cpubench: allow extra optimization flags --- src/cpubench.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cpubench.ts b/src/cpubench.ts index 455a658..d9af348 100644 --- a/src/cpubench.ts +++ b/src/cpubench.ts @@ -20,6 +20,7 @@ export interface RunCPUBenchOptions { platform: sunway.SunwayGeneration | "host"; allowMisaligned?: boolean; action?: string; + extraOptimize?: string[]; } /** @@ -27,6 +28,7 @@ export interface RunCPUBenchOptions { * @param options 运行CPUBench所需的配置选项(可选) */ export async function runCPUBench(options: RunCPUBenchOptions): Promise { + console.log(`Running CPUBench with options: ${JSON.stringify(options)}`); const defaults: Partial = { uuid: true, platform: 'host', @@ -55,7 +57,11 @@ export async function runCPUBench(options: RunCPUBenchOptions): Promise { ] }; - const optimizeFlags = optimizeProfiles[config.optimizeProfile]; + let optimizeFlags = optimizeProfiles[config.optimizeProfile]; + + if (options.extraOptimize) { + optimizeFlags.push(...options.extraOptimize); + } const sunwayGeneration = config.platform === "host" ? sunway.getHostGeneration()