performance_report
Analyze performance metrics and identify bottlenecks in Strudel music patterns to optimize computational efficiency and audio generation.
Instructions
Get performance metrics and bottlenecks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Handler for the 'performance_report' tool. Calls PerformanceMonitor.getReport() and getBottlenecks(5) to generate the response.case 'performance_report': const report = this.perfMonitor.getReport(); const bottlenecks = this.perfMonitor.getBottlenecks(5); return `${report}\n\nTop 5 Bottlenecks:\n${JSON.stringify(bottlenecks, null, 2)}`;
- src/server/EnhancedMCPServerFixed.ts:507-511 (registration)Tool registration in getTools() method, including name, description, and input schema.{ name: 'performance_report', description: 'Get performance metrics and bottlenecks', inputSchema: { type: 'object', properties: {} } },
- PerformanceMonitor.getReport() method generates the formatted performance metrics table used by the tool.getReport(): string { const metrics = this.getMetrics() as any[]; if (!metrics || metrics.length === 0) { return 'No performance metrics collected'; } let report = '\n=== PERFORMANCE REPORT ===\n\n'; report += 'Operation'.padEnd(30) + 'Calls'.padEnd(10) + 'Avg(ms)'.padEnd(12) + 'Min(ms)'.padEnd(12) + 'Max(ms)'.padEnd(12) + 'Errors\n'; report += '-'.repeat(86) + '\n'; metrics.forEach(m => { report += m.operation.padEnd(30) + m.calls.toString().padEnd(10) + m.averageTime.toFixed(2).padEnd(12) + m.minTime.toFixed(2).padEnd(12) + m.maxTime.toFixed(2).padEnd(12) + `${m.errorRate.toFixed(1)}%\n`; }); const totalCalls = metrics.reduce((sum, m) => sum + m.calls, 0); const totalTime = metrics.reduce((sum, m) => sum + m.totalTime, 0); report += '\n'; report += `Total Operations: ${totalCalls}\n`; report += `Total Time: ${totalTime.toFixed(2)}ms\n`; report += `Average per Operation: ${(totalTime / totalCalls).toFixed(2)}ms\n`; return report;
- PerformanceMonitor.getBottlenecks() identifies top slowest operations for the bottlenecks section.getBottlenecks(limit: number = 5) { const metrics = this.getMetrics() as any[]; return metrics .sort((a, b) => b.averageTime - a.averageTime) .slice(0, limit) .map(m => ({ operation: m.operation, averageTime: m.averageTime.toFixed(2) + 'ms', maxTime: m.maxTime.toFixed(2) + 'ms', calls: m.calls })); }