Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
70 lines
2.3 KiB
Go
70 lines
2.3 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/fraktal/mev-beta/tools/performance-audit/internal"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
testType = flag.String("test", "all", "Test type: throughput, latency, memory, cpu, stress, all")
|
|
duration = flag.Duration("duration", 5*time.Minute, "Test duration")
|
|
outputDir = flag.String("output", "reports/performance", "Output directory")
|
|
verbose = flag.Bool("verbose", false, "Enable verbose output")
|
|
concurrent = flag.Int("concurrent", 10, "Number of concurrent workers")
|
|
loadLevel = flag.String("load", "normal", "Load level: light, normal, heavy, extreme")
|
|
profileEnabled = flag.Bool("profile", false, "Enable CPU/memory profiling")
|
|
benchmarkMode = flag.Bool("benchmark", false, "Run in benchmark mode")
|
|
stressTest = flag.Bool("stress", false, "Run stress test scenarios")
|
|
targetTPS = flag.Int("target-tps", 1000, "Target transactions per second")
|
|
maxMemoryMB = flag.Int("max-memory", 512, "Maximum memory usage in MB")
|
|
cpuThreshold = flag.Float64("cpu-threshold", 80.0, "CPU usage threshold percentage")
|
|
)
|
|
flag.Parse()
|
|
|
|
// Create output directory
|
|
if err := os.MkdirAll(*outputDir, 0755); err != nil {
|
|
log.Fatalf("Failed to create output directory: %v", err)
|
|
}
|
|
|
|
// Initialize performance auditor
|
|
auditor, err := internal.NewPerformanceAuditor(&internal.PerformanceAuditConfig{
|
|
TestType: *testType,
|
|
Duration: *duration,
|
|
OutputDir: *outputDir,
|
|
Verbose: *verbose,
|
|
Concurrent: *concurrent,
|
|
LoadLevel: *loadLevel,
|
|
ProfileEnabled: *profileEnabled,
|
|
BenchmarkMode: *benchmarkMode,
|
|
StressTest: *stressTest,
|
|
TargetTPS: *targetTPS,
|
|
MaxMemoryMB: *maxMemoryMB,
|
|
CPUThreshold: *cpuThreshold,
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize performance auditor: %v", err)
|
|
}
|
|
|
|
ctx := context.Background()
|
|
ctx, cancel := context.WithTimeout(ctx, *duration+time.Minute) // Add buffer
|
|
defer cancel()
|
|
|
|
fmt.Printf("Starting performance audit: %s test for %v...\n", *testType, *duration)
|
|
if err := auditor.RunPerformanceTests(ctx); err != nil {
|
|
log.Fatalf("Performance audit failed: %v", err)
|
|
}
|
|
|
|
if err := auditor.GenerateReport(); err != nil {
|
|
log.Fatalf("Report generation failed: %v", err)
|
|
}
|
|
|
|
fmt.Printf("Performance audit complete. Reports saved to: %s\n", *outputDir)
|
|
}
|