blaze-performance-tester 1.1.15 → 1.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,10 +1,20 @@
1
1
  // cli.ts
2
2
  import path from "path";
3
- import { fileURLToPath, pathToFileURL } from "url";
3
+ import { fileURLToPath } from "url";
4
+ import { createRequire } from "module";
4
5
  var __filename = fileURLToPath(import.meta.url);
5
6
  var __dirname = path.dirname(__filename);
6
- var indexPath = path.resolve(__dirname, "../index.js");
7
- var { runBlazeCore } = await import(pathToFileURL(indexPath).href);
7
+ var require2 = createRequire(import.meta.url);
8
+ var nativeBinaryPath = path.resolve(__dirname, "../blaze.win32-x64-msvc.node");
9
+ var nativeBinding;
10
+ try {
11
+ nativeBinding = require2(nativeBinaryPath);
12
+ } catch (error) {
13
+ console.error(`\x1B[31m\u274C Failed to load native binary directly at: ${nativeBinaryPath}\x1B[0m`);
14
+ console.error(error);
15
+ process.exit(1);
16
+ }
17
+ var runBlazeCore = nativeBinding.runBlazeCore;
8
18
  var args = process.argv.slice(2);
9
19
  if (args.length < 3) {
10
20
  console.error("Usage: npx blaze-performance-tester <script-path> <vus> <duration-seconds>");
@@ -20,21 +30,26 @@ console.log(`
20
30
  `);
21
31
  try {
22
32
  const metrics = runBlazeCore(targetScriptPath, vusCount, durationSeconds, csvOutputPath);
23
- const actualDurationSec = (metrics.execution_duration_ms || 0) / 1e3;
24
- const throughput = (metrics.total_requests / (actualDurationSec || 1)).toFixed(2);
25
- const errorRate = (metrics.failed_requests / (metrics.total_requests || 1) * 100).toFixed(2);
33
+ const totalRequests = metrics.totalRequests ?? 0;
34
+ const failedRequests = metrics.failedRequests ?? 0;
35
+ const executionDurationMs = metrics.executionDurationMs ?? 0;
36
+ const avgLatencyMs = metrics.avgLatencyMs ?? 0;
37
+ const maxLatencyMs = metrics.maxLatencyMs ?? 0;
38
+ const actualDurationSec = executionDurationMs / 1e3;
39
+ const throughput = (totalRequests / (actualDurationSec || 1)).toFixed(2);
40
+ const errorRate = (failedRequests / (totalRequests || 1) * 100).toFixed(2);
26
41
  console.log(`\u{1F4CA} ==================== Blaze Performance Report ====================`);
27
42
  console.log(` Target Script: ${targetScript}`);
28
43
  console.log(` Active VUs: ${vusCount} parallel threads`);
29
44
  console.log(` Elapsed Time: ${actualDurationSec.toFixed(2)} seconds`);
30
45
  console.log(`-----------------------------------------------------------------------------`);
31
- console.log(` Samples (Requests): ${metrics.total_requests}`);
46
+ console.log(` Samples (Requests): ${totalRequests}`);
32
47
  console.log(` Throughput Rate: ${throughput} req/sec`);
33
- console.log(` Error Rate: ${errorRate}% (${metrics.failed_requests} failed)`);
48
+ console.log(` Error Rate: ${errorRate}% (${failedRequests} failed)`);
34
49
  console.log(`-----------------------------------------------------------------------------`);
35
50
  console.log(`\u{1F4C8} Latency Statistics (ms):`);
36
- console.log(` \u251C\u2500\u2500 Average: ${metrics.avg_latency_ms.toFixed(2)} ms`);
37
- console.log(` \u2514\u2500\u2500 Maximum: ${metrics.max_latency_ms.toFixed(2)} ms`);
51
+ console.log(` \u251C\u2500\u2500 Average: ${avgLatencyMs.toFixed(2)} ms`);
52
+ console.log(` \u2514\u2500\u2500 Maximum: ${maxLatencyMs.toFixed(2)} ms`);
38
53
  console.log(`=============================================================================`);
39
54
  } catch (error) {
40
55
  console.error("Execution error:", error);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "A high-performance, multi-threaded load testing engine built with Rust and QuickJS.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",