| 812 | } |
| 813 | |
| 814 | function extractStats( |
| 815 | stderr: string, |
| 816 | _output: string, |
| 817 | ): { templatesLoaded: number; requestsSent: number; duration: number } { |
| 818 | const stats = { |
| 819 | templatesLoaded: 0, |
| 820 | requestsSent: 0, |
| 821 | duration: 0, |
| 822 | }; |
| 823 | |
| 824 | const templatesMatch = stderr.match(/(\d+)\s+templates/i); |
| 825 | if (templatesMatch) { |
| 826 | stats.templatesLoaded = parseInt(templatesMatch[1], 10); |
| 827 | } |
| 828 | |
| 829 | const requestsMatch = stderr.match(/(\d+)\s+requests/i); |
| 830 | if (requestsMatch) { |
| 831 | stats.requestsSent = parseInt(requestsMatch[1], 10); |
| 832 | } |
| 833 | |
| 834 | const durationMatch = stderr.match(/(\d+(?:\.\d+)?)\s*s/); |
| 835 | if (durationMatch) { |
| 836 | stats.duration = parseFloat(durationMatch[1]); |
| 837 | } |
| 838 | |
| 839 | return stats; |
| 840 | } |
| 841 | |
| 842 | componentRegistry.register(definition); |
| 843 | |