[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/bourgeoa/JavaScriptSolidServer/patchAppend/visualize-results.js [Back]  [Original]

import fs from 'fs/promises'; import path from 'path'; /** * Simple script to generate an HTML report with charts from benchmark results * Usage: node visualize-results.js path/to/benchmark-report.json */ async function generateVisualization () { // Get the report file path from command line args const reportPath = process.argv[2]; if (!reportPath) { console.error('Please provide a path to the benchmark report JSON file.'); console.error('Usage: node visualize-results.js path/to/benchmark-report.json'); process.exit(1); } try { // Read and parse the report file const reportContent = await fs.readFile(reportPath, 'utf8'); const report = JSON.parse(reportContent); // Create the HTML template with embedded Chart.js const htmlContent = ` JavaScriptSolid Server Benchmark Results

JavaScriptSolid Server Benchmark Results

Server: ${report.server}
Test Date: ${new Date(report.timestamp).toLocaleString()}
Test Duration: ${report.testDuration / 1000} seconds per concurrency level

Response Time Metrics

Register

${report.averageResponseTimes.register.toFixed(2)} ms

Login

${report.averageResponseTimes.login.toFixed(2)} ms

Read

${report.averageResponseTimes.read.toFixed(2)} ms

Write

${report.averageResponseTimes.write.toFixed(2)} ms

Delete

${report.averageResponseTimes.delete.toFixed(2)} ms

Response Time Comparison

Throughput by Concurrent Users

`; // Write the HTML file const htmlFilePath = `benchmark-report-${path.basename(reportPath, '.json')}.html`; await fs.writeFile(htmlFilePath, htmlContent); console.log(`Visualization generated successfully: ${htmlFilePath}`); console.log(`Open this file in a web browser to view the charts.`); } catch (error) { console.error('Error generating visualization:', error.message); process.exit(1); } } // Run the visualization generator generateVisualization();
Web Proxy Viewer  |  New URL  |  Original Page