Buckets:

download
raw
2.17 kB
#!/usr/bin/env python3
"""
Tool Execution Benchmark
"""
import asyncio
import statistics
import time
from typing import Dict
class ToolExecutionBenchmark:
"""Benchmark tool execution performance"""
def __init__(self):
self.results = {}
async def execute_tool(self, tool_name: str, target: str):
"""Simulate tool execution"""
# Simulate execution time
await asyncio.sleep(0.1)
return {"status": "success"}
async def benchmark_tool(self, tool_name: str, target: str, iterations: int = 10) -> Dict:
"""Benchmark a single tool"""
times = []
for i in range(iterations):
start = time.time()
await self.execute_tool(tool_name, target)
elapsed = time.time() - start
times.append(elapsed)
return {
"tool": tool_name,
"iterations": iterations,
"mean_ms": statistics.mean(times) * 1000,
"median_ms": statistics.median(times) * 1000,
"min_ms": min(times) * 1000,
"max_ms": max(times) * 1000,
}
async def run_all_benchmarks(self):
"""Run benchmarks for all tools"""
tools = ["nmap", "httpx", "subfinder"]
target = "127.0.0.1"
for tool in tools:
print(f"Benchmarking {tool}...")
result = await self.benchmark_tool(tool, target)
self.results[tool] = result
return self.results
def generate_report(self) -> str:
"""Generate markdown report"""
report = "# Tool Execution Benchmark Report\n\n"
report += "| Tool | Mean (ms) | Median (ms) | Min (ms) | Max (ms) |\n"
report += "|------|-----------|-------------|----------|----------|\n"
for tool, data in self.results.items():
report += (
f"| {tool} | {data['mean_ms']:.1f} | {data['median_ms']:.1f} | {data['min_ms']:.1f} | {data['max_ms']:.1f} |\n"
)
return report
if __name__ == "__main__":
benchmark = ToolExecutionBenchmark()
results = asyncio.run(benchmark.run_all_benchmarks())
print(benchmark.generate_report())

Xet Storage Details

Size:
2.17 kB
·
Xet hash:
3adc31d02295214930e11a8a073c51b9e5eed378eeac4643f170451a644400a9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.