Skip to content

Commit

Permalink
Add progress abr in benchmark program
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Jun 18, 2024
1 parent f5b8c18 commit 1529505
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion test/benchmark/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -68,7 +70,15 @@ const main = async (): Promise<void> => {
await backend.open();

// DO BENCHMARK
const prev: IPointer<number> = { 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,
Expand All @@ -77,8 +87,15 @@ const main = async (): Promise<void> => {
(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 {
Expand Down

0 comments on commit 1529505

Please sign in to comment.