Skip to content

Commit abba291

Browse files
committed
Getting running on macOS
1 parent 56fc1e5 commit abba291

9 files changed

Lines changed: 53 additions & 14 deletions

File tree

benchmarks/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ The main entrypoint is the `run-benchmarks.sh` script. This script has many opti
1818

1919
> [!TIP]
2020
> This automation currently supports Linux and macOS hosts. Running on Windows Subsystem for Linux (WSL) has not been tested. Running on Windows directly is not supported.
21+
>
22+
> ALSO - it only supports `bash` shell on both local & remote hosts.
2123
2224
The script also has 3 dependencies that need to be resolved before it can be run:
2325
- [git](https://github.com/git-guides/install-git)
2426
- [jbang](https://www.jbang.dev/download)
2527
- [jq](https://stedolan.github.io/jq)
28+
- bash shell
2629

2730
## Usage
2831

benchmarks/helpers/async-profiler.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ scripts:
55
then:
66
- regex: linux
77
then:
8-
- sh: sudo sh -c "echo 1 > /proc/sys/kernel/perf_event_paranoid"
9-
- sh: sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
8+
- script: sudo
9+
with:
10+
command: sh -c "echo 1 > /proc/sys/kernel/perf_event_paranoid"
11+
- script: sudo
12+
with:
13+
command: sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
1014

1115
# downloads the latest async-profiler release to ${{BASE_DIR}}/${{ASYNC_PROFILER}}
1216
download-unpack-async-profiler:

benchmarks/helpers/os.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ scripts:
2020
- sh: uname -v
2121
- set-state: RUN.env.host.VERSION_LEVEL
2222

23+
sudo-linux:
24+
- sh: sudo ${{command}}
25+
26+
sudo-macos:
27+
- sh: ${{command}}
28+
29+
sudo:
30+
- script: sudo-${{os}}
31+
with:
32+
command: ${{command}}
33+
2334
check-and-install-package:
2435
- sh: which ${{command}}
2536
- regex: ".*no ${{command}} in.*"
@@ -29,7 +40,9 @@ scripts:
2940
package: ${{package}}
3041

3142
install-package-linux:
32-
- sh: sudo dnf install -y ${{package}}
43+
- script: sudo
44+
with:
45+
command: dnf install -y ${{package}}
3346
- regex: "Error: Unable to find a match: ${{package}}"
3447
then:
3548
- abort: "Unable to install package: ${{package}}"
@@ -47,12 +60,15 @@ scripts:
4760
- script: install-package-${{os}}
4861

4962
sync-drop-fs-cache-linux:
50-
- sh: sync && sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
63+
- script: sudo
64+
with:
65+
command: sh -c "echo 3 > /proc/sys/vm/drop_caches"
5166

5267
sync-drop-fs-cache-macos:
53-
- sh: sync && sudo purge
68+
- sh: sudo purge
5469

5570
sync-drop-fs-cache:
71+
- sh: sync
5672
- read-state: ${{DROP_OS_FILESYSTEM_CACHES:false}}
5773
then:
5874
- regex: true

benchmarks/helpers/requirements.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ scripts:
1010
- script: ensure-jbang
1111

1212
ensure-gh-cli-linux:
13-
- sh: sudo dnf config-manager addrepo --from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo
13+
- script: sudo
14+
with:
15+
command: dnf config-manager addrepo --from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo
1416
- script: check-and-install-package
1517
with:
1618
command: gh

benchmarks/helpers/sdkman.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ scripts:
1919
"Would you like to upgrade now? (Y/n): ": "Y"
2020
- regex: ".*command not found"
2121
then:
22+
- log: Installing SDKMAN
2223
- sh: curl -s "https://get.sdkman.io" | bash
2324
then:
2425
- regex: "Enjoy"
2526
else:
2627
- abort: failed to install SDKMAN
2728
- sh: source "$HOME/.sdkman/bin/sdkman-init.sh"
2829
else:
30+
- log: Updating SDKMAN
2931
- sh: sdk flush
3032
- sh: sdk selfupdate force
3133
then:
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: jsFunctions
1+
name: state-array functions
22
scripts:
33
state-array-push:
4+
- log: Pushing ${{value}} to ${{array}}
45
- set-state:
56
key: ${{array}}
67
value: ${{=[...${{${{array}}¬[]}}, ${{value}}]}}

benchmarks/helpers/timestamps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: timestamps helper scripts
22
scripts:
33
start-timestamp:
4-
- sh: date --utc +%FT%TZ
4+
- sh: date -u +%FT%TZ
55
then:
66
- set-state: RUN.output.timing.start
77

88
stop-timestamp:
9-
- sh: date --utc +%FT%TZ
9+
- sh: date -u +%FT%TZ
1010
then:
1111
- set-state: RUN.output.timing.stop

benchmarks/main.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,27 @@ states:
9191
TARGET_URL: http://localhost:8080/fruits
9292
QUARKUS-PLATFORM-ARTIFACT-ID: quarkus-bom
9393
PROJ_REPO_NAME: spring-quarkus-perf-comparison
94-
BASE_DIR: "$(echo ${HOME})"
94+
BASE_DIR: "~${{env.USER}}"
9595
METRICS_DIR: /tmp
9696
ASYNC_PROFILER: async-profiler
9797
ASYNC_PROFILER_DIR: ${{BASE_DIR}}/${{ASYNC_PROFILER}}
9898

9999
scripts:
100100
cleanup-env:
101-
- sh: sudo rm -Rf ${{REPO_DIR}}
101+
- script: sudo
102+
with:
103+
command: rm -Rf ${{REPO_DIR}}/${{PROJ_REPO_NAME}}
102104

103105
config-env:
104-
- sh: sudo rm -Rf ${{REPO_DIR}}/logs
106+
- script: sudo
107+
with:
108+
command: rm -Rf ${{REPO_DIR}}/logs
105109
- sh: mkdir -p ${{REPO_DIR}}/logs
106110

107111
clone-repo:
108-
- sh: sudo rm -Rf ${{REPO_DIR}}
112+
- script: sudo
113+
with:
114+
command: rm -Rf ${{REPO_DIR}}
109115
- sh: mkdir -p ${{REPO_DIR}}/logs
110116
- sh: cd ${{REPO_DIR}}
111117
- log: Cloning project repo ${{config.repo.branch}}@${{config.repo.url}}
@@ -379,7 +385,9 @@ scripts:
379385

380386
download-metrics:
381387
- sh: mkdir -p ${{METRICS_DIR}}
382-
- sh: sudo rm -Rf ${{METRICS_DIR}}/metrics.json
388+
- script: sudo
389+
with:
390+
command: rm -Rf ${{METRICS_DIR}}/metrics.json
383391
- set-state: RUN.output.config ${{RUN.config}}
384392
- set-state: RUN.output.env ${{RUN.env}}
385393
- sh: echo '${{RUN.output}}' > ${{METRICS_DIR}}/metrics.json

benchmarks/run-benchmarks.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ run_benchmarks() {
115115

116116
if [[ "$HOST" == "LOCAL" ]]; then
117117
local target="LOCAL"
118+
USER=$(whoami)
118119
else
119120
local target="${USER}@${HOST}"
120121
fi
@@ -139,7 +140,9 @@ run_benchmarks() {
139140
-S config.profiler.events=cpu \
140141
-S config.repo.branch=${SCM_REPO_BRANCH} \
141142
-S config.repo.url=${SCM_REPO_URL} \
143+
-S env.USER=${USER} \
142144
-S env.TARGET=${target} \
145+
-S BASE_DIR=${HOME} \
143146
-S ITERATIONS=${ITERATIONS} \
144147
-S PROJ_REPO_NAME="$(basename ${SCM_REPO_URL} .git)" \
145148
-S RUNTIMES="$(make_json_array ${RUNTIMES})" \

0 commit comments

Comments
 (0)