-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbenchmark.sh
executable file
·48 lines (35 loc) · 900 Bytes
/
benchmark.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
## CPU and Memory usage logging
cpumemmon() (
# "Experimental - I have no idea what I'm doing"
$* &>/dev/null &
pid="$!"
trap ':' INT
echo 'CPU MEM'
while sleep 1; do ps --no-headers -o '%cpu,%mem' -p "$pid"; done
kill "$pid"
)
## Build Project
build(){
# Remove previous build directory if it exists and recreate it
rm -rf build
mkdir -p build
cd build
cmake ..
make
cd ..
}
echo "Time for building:"
time build > /dev/null
## Set CAD Directory
export G4HORUS_CAD_DIR=$(pwd)/cad
## Create output dir and run full simulation
mkdir -p out
cd out
TS=$(date +%Y-%m-%dT%H-%M-%S)
mkdir "${TS}"
cd "${TS}"
echo "Time for startup:"
time ../../build/G4Horus -m ../../scripts/test.mac > /dev/null
echo "Time for long simulation:"
time nice -n 19 ../../build/G4Horus -t 30 -k hist -m ../../scripts/bench.mac > /dev/null