Skip to content

Commit c9504f2

Browse files
committed
AWS instance name is a "CPU" arch in WebUI
1 parent cc4404e commit c9504f2

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

perf-tracking/tools/benchexport/export.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,32 @@ func getBenchmarkSourceFile(name string) string {
465465
return "perf-tracking/benchmarks/core/allocation_test.go"
466466
}
467467

468+
// exportVersionWithCPU exports a single version's benchmarks to JSON, applying
469+
// cpuFallback when the benchmark file lacks a cpu: line.
470+
func exportVersionWithCPU(inputFile, version, outputFile, cpuFallback string) error {
471+
versionData, err := parseBenchmarkFile(inputFile, version)
472+
if err != nil {
473+
return fmt.Errorf("failed to parse benchmark file: %w", err)
474+
}
475+
if versionData.Metadata.System.CPU == "" && cpuFallback != "" {
476+
versionData.Metadata.System.CPU = cpuFallback
477+
}
478+
479+
jsonData, err := json.MarshalIndent(versionData, "", " ")
480+
if err != nil {
481+
return fmt.Errorf("failed to marshal JSON: %w", err)
482+
}
483+
if err := os.MkdirAll(filepath.Dir(outputFile), 0755); err != nil {
484+
return fmt.Errorf("failed to create output directory: %w", err)
485+
}
486+
if err := os.WriteFile(outputFile, jsonData, 0644); err != nil {
487+
return fmt.Errorf("failed to write output file: %w", err)
488+
}
489+
fmt.Printf(" Output: %s\n", outputFile)
490+
fmt.Printf(" ✓ Exported %d benchmarks\n\n", len(versionData.Benchmarks))
491+
return nil
492+
}
493+
468494
// exportVersion exports a single version's benchmarks to JSON
469495
func exportVersion(inputFile, version, outputFile string) error {
470496
fmt.Printf("Exporting Go %s...\n", version)
@@ -580,7 +606,8 @@ func getReliability(maxCV float64) string {
580606
// This makes every export additive: pre-existing version files are never dropped.
581607
// defaultPlatform is used when the platform cannot be auto-detected from the
582608
// benchmark files (e.g. files lack OS/arch metadata).
583-
func exportAll(resultsDir, outputDir, defaultPlatform string) error {
609+
// cpuOverride is used as a fallback when benchmark files lack a cpu: line.
610+
func exportAll(resultsDir, outputDir, defaultPlatform, cpuOverride string) error {
584611
fmt.Println("=== Exporting All Versions ===")
585612

586613
entries, err := os.ReadDir(resultsDir)
@@ -683,7 +710,7 @@ func exportAll(resultsDir, outputDir, defaultPlatform string) error {
683710
platformDir := filepath.Join(outputDir, platform)
684711
outputFile := filepath.Join(platformDir, fmt.Sprintf("go%s.json", version))
685712

686-
if err := exportVersion(latestFile, version, outputFile); err != nil {
713+
if err := exportVersionWithCPU(latestFile, version, outputFile, cpuOverride); err != nil {
687714
fmt.Printf(" Error: %v\n", err)
688715
continue
689716
}

perf-tracking/tools/benchexport/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,17 @@ func main() {
156156
resultsDir := flag.String("results-dir", "", "Results directory (for --export-all)")
157157
outputDir := flag.String("output-dir", "", "Output directory (for --export-all)")
158158
platform := flag.String("platform", "linux-amd64", "Platform identifier used when auto-detection from files fails (for --export-all)")
159+
cpuOverride := flag.String("cpu", "", "CPU identifier used as fallback when benchmark files lack a cpu: line (for --export-all and --export)")
159160

160161
flag.Parse()
161162

162163
// Export mode
163164
if *exportAllFlag {
164165
if *resultsDir == "" || *outputDir == "" {
165-
fmt.Println("Usage: benchexport --export-all --results-dir <dir> --output-dir <dir> [--platform <os-arch>]")
166+
fmt.Println("Usage: benchexport --export-all --results-dir <dir> --output-dir <dir> [--platform <os-arch>] [--cpu <label>]")
166167
os.Exit(1)
167168
}
168-
if err := exportAll(*resultsDir, *outputDir, *platform); err != nil {
169+
if err := exportAll(*resultsDir, *outputDir, *platform, *cpuOverride); err != nil {
169170
fmt.Printf("Error: %v\n", err)
170171
os.Exit(1)
171172
}

perf-tracking/tools/bootstrap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ echo "=== Step 8: System check ==="
200200
BENCHMARK_RESULT="failed: system check"
201201

202202
# Wait for the 1-minute load average to settle after Go installation
203-
echo "→ Waiting 60s for load average to settle after installations..."
204-
sleep 60
203+
echo "→ Waiting 90s for load average to settle after installations..."
204+
sleep 90
205205

206206
runuser -l ec2-user -c "cd $REPO_DIR && perf-tracking/tools/system-check.sh"
207207
echo "✓ System check passed"

0 commit comments

Comments
 (0)