run_with_probe.sh 766 Bytes
Newer Older
one's avatar
one committed
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
#!/usr/bin/env bash
set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root="$(cd "${script_dir}/.." && pwd)"
mode="${1:-fastpt-C}"
device="${2:-${DEVICE:-0}}"
out_root="${OUT_ROOT:-${root}/results-probe}"
log="${FASTPT_MRE_PROBE_LOG:-${out_root}/${mode}/runtime_probe.csv}"
probe_lib="${root}/build-probe/libruntime_probe.so"

mkdir -p "${root}/build-probe"
c++ -std=c++17 -O2 -fPIC -shared \
    "${root}/src/runtime_probe.cpp" \
    -ldl \
    -o "${probe_lib}"

mkdir -p "$(dirname "${log}")"
echo "pid,api,calls,total_ns,avg_ns" > "${log}"

FASTPT_MRE_PROBE_LOG="${log}" \
OUT_ROOT="${out_root}" \
LD_PRELOAD="${probe_lib}${LD_PRELOAD:+:${LD_PRELOAD}}" \
bash "${script_dir}/run_one.sh" "${mode}" "${device}"

echo "PROBE_LOG,${log}"