mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/benchmark/examples/basic/benchmark_with_reports.py
This commit is contained in:
1 parent
63302bede6
commit
f3fcbc00ec
8 files changed
+387
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250806-115350", "file": "/workspaces/claude-code-flow/benchmark/test_improved_report.py", "timestamp": "2025-08-06T11:53:50Z", "type": "pre-edit", "original_branch": "alpha-88"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250806-115352", "file": "/workspaces/claude-code-flow/benchmark/test_improved_report.py", "timestamp": "2025-08-06T11:53:52Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 60 +++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +-- .claude/checkpoints/1754481202.json | 1 + .claude/checkpoints/1754481204.json | 1 + .../cli/__pycache__/main.cpython-312.pyc | Bin 29784 -> 36741 bytes benchmark/test_improved_report.py | 35 ++++++++++++ claude-flow-wiki | 0 8 files changed, 101 insertions(+), 4 deletions(-) "}
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Example showing the improved benchmark reporting with detailed metrics and file references.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
def run_benchmark_with_report(task, strategy="auto"):
|
||||
"""Run a benchmark and display the improved report."""
|
||||
|
||||
print(f"\n🚀 Running benchmark: {task}")
|
||||
print("-" * 60)
|
||||
|
||||
cmd = [
|
||||
"swarm-benchmark", "real", "swarm",
|
||||
task,
|
||||
"--strategy", strategy,
|
||||
"--timeout", "2",
|
||||
"--output-dir", "./my-benchmarks"
|
||||
]
|
||||
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
|
||||
# Display the output (which now includes detailed report)
|
||||
print(result.stdout)
|
||||
|
||||
# Parse the results file if created
|
||||
results_dir = Path("./my-benchmarks")
|
||||
if results_dir.exists():
|
||||
# Find the most recent benchmark file
|
||||
json_files = list(results_dir.glob("benchmark_*.json"))
|
||||
if json_files:
|
||||
latest_file = max(json_files, key=lambda p: p.stat().st_mtime)
|
||||
|
||||
print(f"\n📂 Reading results from: {latest_file}")
|
||||
with open(latest_file) as f:
|
||||
data = json.load(f)
|
||||
|
||||
print("\n🔍 Key Metrics from JSON:")
|
||||
if 'metrics' in data:
|
||||
metrics = data['metrics']
|
||||
print(f" - Execution Time: {metrics.get('wall_clock_time', 'N/A')}s")
|
||||
print(f" - Success Rate: {metrics.get('success_rate', 'N/A')}")
|
||||
print(f" - Peak Memory: {metrics.get('peak_memory_mb', 'N/A')} MB")
|
||||
|
||||
print(f"\n📊 Benchmark ID: {data.get('benchmark_id', 'N/A')}")
|
||||
print(f"📋 Status: {data.get('status', 'N/A')}")
|
||||
|
||||
return result.returncode == 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Example 1: Simple task
|
||||
success = run_benchmark_with_report(
|
||||
"Create a hello world function",
|
||||
strategy="development"
|
||||
)
|
||||
|
||||
# Example 2: More complex task
|
||||
if success:
|
||||
run_benchmark_with_report(
|
||||
"Design a REST API with authentication",
|
||||
strategy="analysis"
|
||||
)
|
||||
|
||||
print("\n✅ Benchmark examples completed!")
|
||||
print("Check ./my-benchmarks/ for detailed results files")
|
||||
|
||||
sys.exit(0 if success else 1)
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"benchmark_id": "1be63008-e1d4-4020-a6c6-7d253ecc91de",
|
||||
"status": "success",
|
||||
"summary": "Completed 1 tasks",
|
||||
"duration": 0.304714,
|
||||
"metrics": {
|
||||
"wall_clock_time": 1.305997610092163,
|
||||
"tasks_per_second": 0.7656981852588772,
|
||||
"success_rate": 1.0,
|
||||
"peak_memory_mb": 0.0,
|
||||
"average_cpu_percent": 0.0,
|
||||
"total_output_lines": 1
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"id": "91ad43a0-cf92-497a-a4ec-1ccf5d1a05ea",
|
||||
"task_id": "9252339f-7268-40d0-b94d-710977b3b380",
|
||||
"agent_id": "claude-flow",
|
||||
"status": "success",
|
||||
"output": {
|
||||
"raw_output": "\u274c Failed to run SPARC mode: Deno is not defined",
|
||||
"lines": [
|
||||
"\u274c Failed to run SPARC mode: Deno is not defined"
|
||||
],
|
||||
"sections": {}
|
||||
},
|
||||
"errors": [],
|
||||
"warnings": [],
|
||||
"execution_time": 0.26503849029541016,
|
||||
"resource_usage": {
|
||||
"cpu_percent": 96.1,
|
||||
"memory_mb": 41.359375
|
||||
},
|
||||
"created_at": "2025-08-06T11:53:58.880284",
|
||||
"completed_at": "2025-08-06T11:53:58.879810"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"success": true,
|
||||
"command": [
|
||||
"/workspaces/claude-code-flow/claude-flow",
|
||||
"hive-mind",
|
||||
"spawn",
|
||||
"--non-interactive",
|
||||
"Create API",
|
||||
"--count",
|
||||
"2",
|
||||
"--coordination",
|
||||
"majority"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"duration": 0.35389065742492676,
|
||||
"stdout_lines": [
|
||||
"\u001b[32m?\u001b[39m \u001b[1mWhat is the swarm objective?\u001b[22m\u001b[0m \u001b[0m\u001b[31D\u001b[31C"
|
||||
],
|
||||
"stderr_lines": [],
|
||||
"input_tokens": 0,
|
||||
"output_tokens": 0,
|
||||
"total_tokens": 0,
|
||||
"agents_spawned": 0,
|
||||
"tasks_completed": 0,
|
||||
"tool_calls": [],
|
||||
"tool_results": [],
|
||||
"errors": [],
|
||||
"warnings": [],
|
||||
"first_response_time": null,
|
||||
"completion_time": 0.35389065742492676
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"summary": {
|
||||
"wall_clock_time": 1.305997610092163,
|
||||
"tasks_per_second": 0.7656981852588772,
|
||||
"success_rate": 1.0,
|
||||
"peak_memory_mb": 0.0,
|
||||
"average_cpu_percent": 0.0
|
||||
},
|
||||
"performance": {
|
||||
"average_duration": 0.0,
|
||||
"median_duration": 0.0,
|
||||
"p95_duration": 0.0,
|
||||
"p99_duration": 0.0,
|
||||
"total_cpu_seconds": 0.0
|
||||
},
|
||||
"resources": {
|
||||
"memory": {
|
||||
"peak_mb": 0.0,
|
||||
"average_mb": 0.0
|
||||
},
|
||||
"cpu": {
|
||||
"average_percent": 0.0,
|
||||
"total_seconds": 0.0
|
||||
},
|
||||
"io": {
|
||||
"disk_read_mb": 0.0,
|
||||
"disk_write_mb": 0.0,
|
||||
"network_sent_mb": 0.0,
|
||||
"network_recv_mb": 0.0
|
||||
}
|
||||
},
|
||||
"processes": {
|
||||
"total": 1,
|
||||
"peak_threads": 0,
|
||||
"peak_fds": 0
|
||||
},
|
||||
"output": {
|
||||
"total_size": 1,
|
||||
"average_size": 1,
|
||||
"complexity_score": 0.7656981852588772
|
||||
},
|
||||
"collectors": {
|
||||
"performance": 1,
|
||||
"resource": 1
|
||||
},
|
||||
"timestamp": "2025-08-06T11:54:01.884811",
|
||||
"process_executions": {
|
||||
"sparc:{\"positional\": [\"coder\", \"Design hello world\"]}": {
|
||||
"command_type": "sparc",
|
||||
"args": {
|
||||
"positional": [
|
||||
"coder",
|
||||
"Design hello world"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"success_count": 1,
|
||||
"failure_count": 0,
|
||||
"success_rate": 1.0,
|
||||
"average_duration": 0.3036916255950928,
|
||||
"total_duration": 0.3036916255950928,
|
||||
"average_memory_mb": 41.359375,
|
||||
"peak_memory_mb": 67.30859375
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"summary": {
|
||||
"total_executions": 1,
|
||||
"successful_executions": 1,
|
||||
"failed_executions": 0,
|
||||
"overall_success_rate": 1.0,
|
||||
"total_duration": 0.3036916255950928,
|
||||
"average_duration": 0.3036916255950928,
|
||||
"peak_memory_mb": 67.30859375,
|
||||
"average_memory_mb": 41.359375,
|
||||
"total_output_lines": 1,
|
||||
"total_errors": 1
|
||||
},
|
||||
"command_statistics": {
|
||||
"sparc:{\"positional\": [\"coder\", \"Design hello world\"]}": {
|
||||
"command_type": "sparc",
|
||||
"args": {
|
||||
"positional": [
|
||||
"coder",
|
||||
"Design hello world"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"success_count": 1,
|
||||
"failure_count": 0,
|
||||
"success_rate": 1.0,
|
||||
"average_duration": 0.3036916255950928,
|
||||
"total_duration": 0.3036916255950928,
|
||||
"average_memory_mb": 41.359375,
|
||||
"peak_memory_mb": 67.30859375
|
||||
}
|
||||
},
|
||||
"executions": [
|
||||
{
|
||||
"command": "claude-flow sparc coder Design hello world",
|
||||
"exit_code": 0,
|
||||
"success": true,
|
||||
"duration": 0.3036916255950928,
|
||||
"start_time": 1754481238.5761182,
|
||||
"output_size": 1,
|
||||
"error_count": 1,
|
||||
"cpu_percent": 96.1,
|
||||
"memory_mb": 41.359375,
|
||||
"peak_memory_mb": 67.30859375
|
||||
}
|
||||
]
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
{
|
||||
"id": "1be63008-e1d4-4020-a6c6-7d253ecc91de",
|
||||
"name": "real-benchmark-development-centralized",
|
||||
"description": "Real Benchmark: Design hello world",
|
||||
"status": "completed",
|
||||
"config": {
|
||||
"name": "real-benchmark-development-centralized",
|
||||
"description": "Real Benchmark: Design hello world",
|
||||
"strategy": "development",
|
||||
"mode": "centralized",
|
||||
"max_agents": 5,
|
||||
"max_tasks": 100,
|
||||
"timeout": 60,
|
||||
"task_timeout": 300,
|
||||
"max_retries": 3,
|
||||
"parallel": false,
|
||||
"background": false,
|
||||
"monitoring": false,
|
||||
"quality_threshold": 0.8,
|
||||
"resource_limits": {
|
||||
"max_memory_mb": 1024,
|
||||
"max_cpu_percent": 80,
|
||||
"max_network_mbps": 100
|
||||
},
|
||||
"output_formats": [
|
||||
"json"
|
||||
],
|
||||
"output_directory": "./reports",
|
||||
"verbose": false
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"id": "9252339f-7268-40d0-b94d-710977b3b380",
|
||||
"objective": "Design hello world",
|
||||
"description": "Benchmark task: Design hello world",
|
||||
"strategy": "development",
|
||||
"mode": "centralized",
|
||||
"parameters": {},
|
||||
"timeout": 300,
|
||||
"max_retries": 3,
|
||||
"priority": 1,
|
||||
"status": "pending",
|
||||
"created_at": "2025-08-06T11:53:58.575540",
|
||||
"started_at": null,
|
||||
"completed_at": null,
|
||||
"duration": null,
|
||||
"assigned_agents": [],
|
||||
"parent_task_id": null,
|
||||
"subtasks": [],
|
||||
"dependencies": []
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"id": "91ad43a0-cf92-497a-a4ec-1ccf5d1a05ea",
|
||||
"task_id": "9252339f-7268-40d0-b94d-710977b3b380",
|
||||
"agent_id": "claude-flow",
|
||||
"status": "success",
|
||||
"output": {
|
||||
"raw_output": "\u274c Failed to run SPARC mode: Deno is not defined",
|
||||
"lines": [
|
||||
"\u274c Failed to run SPARC mode: Deno is not defined"
|
||||
],
|
||||
"sections": {}
|
||||
},
|
||||
"errors": [],
|
||||
"warnings": [],
|
||||
"performance_metrics": {
|
||||
"execution_time": 0.26503849029541016,
|
||||
"queue_time": 0.0,
|
||||
"throughput": 3.7730368856440686,
|
||||
"success_rate": 1.0,
|
||||
"error_rate": 0.0,
|
||||
"retry_count": 0,
|
||||
"coordination_overhead": 0.0,
|
||||
"communication_latency": 0.0
|
||||
},
|
||||
"quality_metrics": {
|
||||
"accuracy_score": 0.0,
|
||||
"completeness_score": 1.0,
|
||||
"consistency_score": 0.0,
|
||||
"relevance_score": 0.0,
|
||||
"overall_quality": 0.5,
|
||||
"review_score": null,
|
||||
"automated_score": null
|
||||
},
|
||||
"resource_usage": {
|
||||
"cpu_percent": 96.1,
|
||||
"memory_mb": 41.359375,
|
||||
"network_bytes_sent": 0,
|
||||
"network_bytes_recv": 0,
|
||||
"disk_bytes_read": 0,
|
||||
"disk_bytes_write": 0,
|
||||
"peak_memory_mb": 67.30859375,
|
||||
"average_cpu_percent": 96.1
|
||||
},
|
||||
"execution_details": {
|
||||
"command": "claude-flow sparc coder Design hello world",
|
||||
"exit_code": 0,
|
||||
"output_lines": 1,
|
||||
"error_count": 1
|
||||
},
|
||||
"created_at": "2025-08-06T11:53:58.880284",
|
||||
"started_at": "2025-08-06T11:53:58.576118",
|
||||
"completed_at": "2025-08-06T11:53:58.879810",
|
||||
"duration": 0.303692
|
||||
}
|
||||
],
|
||||
"metrics": {
|
||||
"total_tasks": 1,
|
||||
"completed_tasks": 1,
|
||||
"failed_tasks": 0,
|
||||
"total_agents": 0,
|
||||
"active_agents": 0,
|
||||
"average_execution_time": 0.0,
|
||||
"total_execution_time": 1.305997610092163,
|
||||
"success_rate": 1.0,
|
||||
"throughput": 0.7656981852588772,
|
||||
"resource_efficiency": 0.0,
|
||||
"coordination_efficiency": 1.0,
|
||||
"quality_score": 0.0,
|
||||
"peak_memory_usage": 0.0,
|
||||
"total_cpu_time": 0.0,
|
||||
"network_overhead": 0.0
|
||||
},
|
||||
"created_at": "2025-08-06T11:53:58.575564",
|
||||
"started_at": "2025-08-06T11:53:58.575591",
|
||||
"completed_at": "2025-08-06T11:53:58.880305",
|
||||
"duration": 0.304714,
|
||||
"error_log": [],
|
||||
"metadata": {}
|
||||
}
|
||||
Reference in new issue
Block a user