From 1529505122749f353479c39add518eba9acae061 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Tue, 18 Jun 2024 22:25:05 +0900 Subject: [PATCH] Add progress abr in benchmark program --- ...D Ryzen 9 7940HS w Radeon 780M Graphics.md | 8 ++++---- package.json | 4 +++- test/benchmark/index.ts | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md b/docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md index 5fba8fc..6b66d07 100644 --- a/docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md +++ b/docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md @@ -7,18 +7,18 @@ > - Count: 1,024 > - Threads: 4 > - Simultaneous: 32 -> - Total Elapsed Time: 501 ms +> - Total Elapsed Time: 526 ms ### Total Type | Count | Success | Mean. | Stdev. | Minimum | Maximum ----|----|----|----|----|----|---- -Total | 1,052 | 1,052 | 14.08 | 7.8 | 3 | 74 +Total | 1,052 | 1,052 | 15.02 | 6.82 | 8 | 58 ### Endpoints Type | Count | Success | Mean. | Stdev. | Minimum | Maximum ----|----|----|----|----|----|---- -GET /monitors/system | 563 | 563 | 14.12 | 7.78 | 3 | 71 -GET /monitors/health | 489 | 489 | 14.04 | 7.83 | 4 | 74 +GET /monitors/health | 517 | 517 | 15.24 | 7.26 | 8 | 58 +GET /monitors/system | 535 | 535 | 14.81 | 6.37 | 9 | 58 ### Failures Method | Path | Count | Success diff --git a/package.json b/package.json index 1853941..de6054e 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,11 @@ }, "homepage": "https://github.com/samchon/backend", "devDependencies": { - "@nestia/e2e": "^0.5.0", + "@nestia/e2e": "^0.5.4", "@nestia/sdk": "^3.2.2", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/cli": "^0.11.19", + "@types/cli-progress": "^3.11.5", "@types/express": "^4.17.21", "@types/inquirer": "^8.2.5", "@types/jsonwebtoken": "^9.0.4", @@ -54,6 +55,7 @@ "@typescript-eslint/parser": "^7.1.0", "chalk": "^4.1.2", "cli": "^1.0.1", + "cli-progress": "^3.12.0", "commander": "10.0.0", "copy-webpack-plugin": "^12.0.2", "eslint-plugin-deprecation": "^2.0.0", diff --git a/test/benchmark/index.ts b/test/benchmark/index.ts index bae1bfb..f058f28 100644 --- a/test/benchmark/index.ts +++ b/test/benchmark/index.ts @@ -1,6 +1,8 @@ import { DynamicBenchmarker, StopWatch } from "@nestia/e2e"; +import cliProgress from "cli-progress"; import fs from "fs"; import os from "os"; +import { IPointer } from "tstl"; import { MyBackend } from "../../src/MyBackend"; import { MyConfiguration } from "../../src/MyConfiguration"; @@ -68,7 +70,15 @@ const main = async (): Promise => { await backend.open(); // DO BENCHMARK + const prev: IPointer = { value: 0 }; + const bar: cliProgress.SingleBar = new cliProgress.SingleBar( + {}, + cliProgress.Presets.shades_classic, + ); + bar.start(options.count, 0); + const report: DynamicBenchmarker.IReport = await DynamicBenchmarker.master({ + servant: `${__dirname}/servant.js`, count: options.count, threads: options.threads, simultaneous: options.simultaneous, @@ -77,8 +87,15 @@ const main = async (): Promise => { (options.include ?? []).some((str) => func.includes(str))) && (!options.exclude?.length || (options.exclude ?? []).every((str) => !func.includes(str))), - servant: `${__dirname}/servant.js`, + progress: (value: number) => { + if (value >= 100 + prev.value) { + bar.update(value); + prev.value = value; + } + }, + stdio: "ignore", }); + bar.stop(); // DOCUMENTATION try {