#!/usr/bin/env elixir # Comprehensive AsyncCorrelator Performance Testing Suite # This script runs all performance tests to validate the AsyncCorrelator system IO.puts("=== AsyncCorrelator Performance Testing Suite ===") IO.puts("") # Ensure application is started {:ok, _} = Application.ensure_all_started(:da_product_app) # Wait a moment for the system to initialize Process.sleep(2000) # Import the performance testing modules alias MercuryDeviceMiddlelayer.AsyncCorrelatorPerformance alias MercuryDeviceMiddlelayer.AsyncCorrelatorOptimizer alias MercuryDeviceMiddlelayer.AsyncCorrelatorDashboard IO.puts("1. Running Load Testing...") try do load_test_result = AsyncCorrelatorPerformance.run_load_test( %{ concurrency: 10, duration_ms: 5000, network_id: :visa_network } ) IO.inspect(load_test_result, label: "Load Test Result") rescue e -> IO.puts("Load Test Error: #{inspect(e)}") end IO.puts("\n2. Running ETS Performance Benchmarking...") try do ets_benchmark_result = AsyncCorrelatorPerformance.run_ets_benchmark( %{ operations_count: 1000, concurrent_processes: 5 } ) IO.inspect(ets_benchmark_result, label: "ETS Benchmark Result") rescue e -> IO.puts("ETS Benchmark Error: #{inspect(e)}") end IO.puts("\n3. Running Memory Profiling...") try do memory_profile_result = AsyncCorrelatorPerformance.run_memory_profile( %{ duration_ms: 3000, sample_interval_ms: 500 } ) IO.inspect(memory_profile_result, label: "Memory Profile Result") rescue e -> IO.puts("Memory Profile Error: #{inspect(e)}") end IO.puts("\n4. Running System Optimization Analysis...") try do optimization_result = AsyncCorrelatorOptimizer.analyze_and_optimize() IO.inspect(optimization_result, label: "Optimization Result") rescue e -> IO.puts("Optimization Error: #{inspect(e)}") end IO.puts("\n5. Running Dashboard Health Check...") try do dashboard_health = AsyncCorrelatorDashboard.get_health_status() IO.inspect(dashboard_health, label: "Dashboard Health") rescue e -> IO.puts("Dashboard Health Error: #{inspect(e)}") end IO.puts("\n6. Running Comprehensive System Status Check...") try do system_status = AsyncCorrelatorPerformance.get_system_status() IO.inspect(system_status, label: "System Status") rescue e -> IO.puts("System Status Error: #{inspect(e)}") end IO.puts("\n=== Performance Testing Suite Complete ===")