Commit | Line | Data |
---|---|---|
bd0e5c4d JB |
1 | #!/usr/bin/env bash |
2 | ||
7a6a0a96 JB |
3 | ### The -t argument permit to specify the type of task that you want to benchmark. |
4 | ### The -s argument permit to specify the size of task that you want to benchmark. | |
5 | ### Supported values are CPU_INTENSIVE, IO_INTENSIVE | |
be0676b3 | 6 | |
9f7e7a99 | 7 | taskType='CPU_INTENSIVE' |
7a6a0a96 JB |
8 | taskSize=5000 |
9 | while getopts "t:s:h" option | |
9f7e7a99 | 10 | do |
7a6a0a96 | 11 | case "${option}" in |
bd0e5c4d JB |
12 | t) |
13 | taskType=${OPTARG} | |
14 | ;; | |
7a6a0a96 JB |
15 | s) |
16 | taskSize=${OPTARG} | |
17 | ;; | |
18 | *|h) | |
19 | echo "Usage: $0 [-t taskType] [-s taskSize]" | |
20 | exit 1 | |
21 | ;; | |
bd0e5c4d | 22 | esac |
9f7e7a99 | 23 | done |
be0676b3 | 24 | |
7a6a0a96 JB |
25 | echo 'Running benchmarks for task type:' ${taskType} 'and task size:' ${taskSize} |
26 | export TASK_TYPE=${taskType} | |
27 | export TASK_SIZE=${taskSize} | |
9f7e7a99 | 28 | # Execute bench |
29 | export NODE_ENV=production | |
be0676b3 APA |
30 | export POOL_SIZE=10 |
31 | export NUM_ITERATIONS=100000 | |
bd0e5c4d JB |
32 | case "$OSTYPE" in |
33 | darwin*) | |
34 | caffeinate ./hyperfine_benchmarks.sh | |
35 | ;; | |
36 | linux*) | |
37 | systemd-inhibit ./hyperfine_benchmarks.sh | |
38 | ;; | |
39 | *) | |
40 | echo "Unsupported $OSTYPE" | |
41 | ;; | |
42 | esac |