forked from usnistgov/ndn-dpdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
22 lines (20 loc) · 773 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import getStdin from "get-stdin";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { runBenchmark } from "./benchmark";
import { serve } from "./serve";
await yargs(hideBin(process.argv))
.scriptName("ndndpdk-benchmark")
.command("serve", "serve webapp",
(argv) => argv.option("port", { default: 3333, desc: "listen port", type: "number" }),
async (argv) => {
await serve(argv.port);
},
).command("benchmark", "run benchmark on CLI (pass BenchmarkOptions to stdin)",
(argv) => argv
.option("count", { alias: "c", default: 1e3, desc: "iteration count", type: "number" }),
async (argv) => {
const opts = JSON.parse(await getStdin());
await runBenchmark(opts, argv.count);
},
).parseAsync();