Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,15 @@ DCPERF_PERF_RECORD=1 ./benchpress_cli.py run oss_performance_mediawiki_mlp
After the benchmark finishes, the profile `perf.data` will be available in the
`benchmark_metrics_<uuid>` folder. (`benchmark_metrics_<uuid>/work` for SparkBench)

### Tracing

FeedSim can record an instruction and memory trace of its server with DynamoRIO
during the final measurement window. Install with `ENABLE_DR_TRACE=1` and run
with `DCPERF_DR_TRACE=1`; see
[Tracing with DynamoRIO](packages/feedsim/README.md#tracing-with-dynamorio).
To add tracing to another benchmark, see the
[`dr_trace` library](packages/common/dr_trace/README.md).

### Expected CPU Utilization

Below is a table of our expectation on CPU utilization of these benchmarks.
Expand Down
30 changes: 15 additions & 15 deletions packages/common/dr_trace/install_dynamorio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#
# Prerequisites:
# - BUILD_DIR must be set to the benchmark's build directory
# - cmake, git, and a C/C++ compiler must be available
# - sudo access (to install system dependencies)
# - a C/C++ compiler must be available
# - sudo access (to install system dependencies, including cmake and git)
#
# After sourcing:
# - DR_INSTALL is exported, pointing to the DynamoRIO install prefix
Expand All @@ -34,17 +34,6 @@ if [ ! -d "${BUILD_DIR}" ]; then
fail "BUILD_DIR='${BUILD_DIR}' does not exist."
fi

for cmd in cmake git; do
if ! command -v "${cmd}" >/dev/null 2>&1; then
fail "'${cmd}' is not installed or not in PATH."
fi
done

# Check for a working C++ compiler (cmake will fail late with a cryptic error)
if ! command -v c++ >/dev/null 2>&1 && ! command -v g++ >/dev/null 2>&1 && ! command -v clang++ >/dev/null 2>&1; then
fail "No C++ compiler found (need c++, g++, or clang++ in PATH)."
fi

# ---- Build configuration ----

# Pinned DynamoRIO version (cronbuild tag from GitHub)
Expand All @@ -68,9 +57,20 @@ echo "[DR_TRACE] Building DynamoRIO ${DR_VERSION} from source..."
# Install system dependencies for DynamoRIO and dr_trace
echo "[DR_TRACE] Installing system dependencies..."
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get install -y -qq libelf-dev zlib1g-dev liblz4-dev libsnappy-dev
sudo apt-get install -y -qq cmake git libelf-dev zlib1g-dev liblz4-dev libsnappy-dev
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y -q elfutils-libelf-devel zlib-devel lz4-devel snappy-devel
sudo dnf install -y -q cmake git elfutils-libelf-devel zlib-devel lz4-devel snappy-devel
fi

for cmd in cmake git; do
if ! command -v "${cmd}" >/dev/null 2>&1; then
fail "'${cmd}' is not installed or not in PATH."
fi
done

# Check for a working C++ compiler
if ! command -v c++ >/dev/null 2>&1 && ! command -v g++ >/dev/null 2>&1 && ! command -v clang++ >/dev/null 2>&1; then
fail "No C++ compiler found (need c++, g++, or clang++ in PATH)."
fi

# Clone with submodules (elfutils is a submodule required by drsyms)
Expand Down
83 changes: 83 additions & 0 deletions packages/feedsim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,89 @@ Runner-level parameters (can be passed via `extra_args` parameter):
For the full list of runner flags, see
`./benchmarks/feedsim/run.sh -h`.

## Tracing with DynamoRIO

FeedSim can record an instruction and memory trace of `LeafNodeRank` with the
[DynamoRIO](https://dynamorio.org/) `drmemtrace` client during the final
measurement window. DynamoRIO is linked into `LeafNodeRank` only when enabled
at install time; a default install is unchanged.

### Install

```bash
ENABLE_DR_TRACE=1 ./benchpress_cli.py install feedsim_dlrm -f
```

This builds DynamoRIO (`cronbuild-11.90.20482`) into
`benchmarks/feedsim/third_party/dynamorio` and links it statically into
`LeafNodeRank`. Pass `-f` to rebuild an existing install without tracing. The
same build serves both `feedsim_dlrm` and `feedsim_autoscale_dlrm`.

### Collect a trace

Multi-instance (`feedsim_autoscale_dlrm`, traces only the instance on port
`21212`; `FEEDSIM_ADAPTIVE_DEPTH_MAX=1` caps driver depth at 1 so tracing
stays within the 700 ms SLA):

```bash
FEEDSIM_ADAPTIVE_DEPTH_MAX=1 DCPERF_DR_TRACE=1 DR_TRACE_OUTDIR=/path/to/trace \
./benchpress_cli.py run feedsim_autoscale_dlrm
```

Single-instance (`feedsim_dlrm`):

```bash
DCPERF_DR_TRACE=1 DR_TRACE_OUTDIR=/path/to/trace ./benchpress_cli.py run feedsim_dlrm
```

The runner creates `DR_TRACE_OUTDIR` automatically. During the final
measurement window, `LeafNodeRank` waits on `$DR_TRACE_OUTDIR/dr_trace_trigger`;
after `DR_TRACE_SETTLE_SECONDS`, the runner triggers tracing across all
`LeafNodeRank` threads for `DR_TRACE_DURATION_SECONDS`, then waits for the
output directory to finish flushing after the benchmark exits. Raw per-thread
files are written under
`$DR_TRACE_OUTDIR/drmemtrace.LeafNodeRank.<pid>.<n>.dir/raw/`.

| Variable | Default | Meaning |
|---|---|---|
| `DCPERF_DR_TRACE` | unset | Set to `1` to trace during the final window. |
| `DR_TRACE_OUTDIR` | `/tmp/drmemtrace_out` | Directory for the trigger pipe and output trace. |
| `DR_TRACE_SETTLE_SECONDS` | `30` | Delay from the start of the final window before triggering. |
| `DR_TRACE_DURATION_SECONDS` | `10` | Trace duration in seconds. |
| `DR_TRACE_PORT` | unset | Instance port to trace. Defaults to the sole instance, or port `21212` in multi-instance runs. |
| `DR_TRACE_TRIGGER` | `pipe` | `pipe` (runner-triggered), `delay` (10 s trace starting 15 s after server start), or `off`. |
| `DR_TRACE_FLUSH_TIMEOUT_SECONDS` | `300` | Maximum wait in seconds for trace files to finish flushing. |

### Decode the trace

Run `drraw2trace` on the host that collected the trace so it can read the
binaries listed in `raw/modules.log`:

```bash
DR=./benchmarks/feedsim/third_party/dynamorio
D=/path/to/trace/drmemtrace.LeafNodeRank.<pid>.<n>.dir
mkdir -p "$D/trace"
"$DR/tools/bin64/drraw2trace" -indir "$D/raw" -out "$D/trace" -jobs "$(nproc)"
```

Optional checks with `drcachesim`:

```bash
"$DR/bin64/drrun" -t drcachesim -simulator_type invariant_checker -indir "$D"
"$DR/bin64/drrun" -t drcachesim -simulator_type basic_counts -indir "$D"
```

### Notes

- **Disk space:** A 10 s trace can require tens of GB for raw and decoded
files combined; point `DR_TRACE_OUTDIR` to a filesystem with enough free
space.
- **Performance impact:** Tracing degrades benchmark performance compared to a
non-tracing run (it stalls `LeafNodeRank` during capture and flush). Do not
use a traced run's score as a performance result; the benchmark JSON marks
traced runs with `"dr_trace": 1`.
- **Unsupported jobs:** `feedsim_dlrm_mini` is not supported.

## Legacy — `feedsim_autoscale` (v1)

Again, due to the fundamental change in software architecture and threading model,
Expand Down
Loading