hipfile/util: USDT (user statically-defined tracing) powered ais-stats.py#145
hipfile/util: USDT (user statically-defined tracing) powered ais-stats.py#145kurtmcmillan wants to merge 5 commits into
Conversation
|
Example using ais-stats.py: |
Ensure that all hipfile probes have the same group identifier.
f2feda7 to
12e008e
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds User Statically-Defined Tracing (USDT) support to hipfile, enabling runtime observability of IO operations. The implementation includes USDT probe definitions in the IO path and provides a Python script to collect and display statistics when attached to a client process.
Changes:
- Added USDT library header for defining and triggering tracepoints with zero overhead
- Integrated USDT probes into both AIS and POSIX IO paths to track read/write operations
- Created a Python script that uses BPF to attach to USDT probes and collect IO statistics
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| util/ais-stat.py | Python script using BCC/BPF to spawn client processes and collect USDT-based IO statistics |
| src/amd_detail/usdt.h | Single-header USDT library providing macros for defining tracepoints |
| src/amd_detail/trace.h | Wrapper header defining hipfile-specific USDT macros |
| src/amd_detail/backend/fastpath.cpp | Added USDT probe for AIS IO operations |
| src/amd_detail/backend/fallback.cpp | Added USDT probe for POSIX IO operations |
| .clang-format-ignore | Excluded usdt.h from clang-format to preserve upstream formatting |
Comments suppressed due to low confidence (1)
util/ais-stat.py:1
- The
##token pasting operator and__VA_OPT__are being used incorrectly together. Line 291 uses##__VA_ARGS__but should use__VA_OPT__(,) __VA_ARGS__to match the pattern in line 294, which is inside the#elseblock. The positions of these two lines appear to be swapped.
#! /usr/bin/env python3
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| def main(): | ||
| if os.geteuid() != 0: | ||
| printf("ais-stat must be run as root", file=sys.stderr) |
There was a problem hiding this comment.
The function name is incorrect: printf should be print. This will cause a NameError at runtime.
| printf("ais-stat must be run as root", file=sys.stderr) | |
| print("ais-stat must be run as root", file=sys.stderr) |
|
|
||
| def parse_args(): | ||
| parser = argparse.ArgumentParser( | ||
| description="hipfile statistics" |
There was a problem hiding this comment.
Changed 'hipfile statistics' to 'HIPfile statistics' for consistency with project naming conventions.
| description="hipfile statistics" | |
| description="HIPfile statistics" |
|
Closing. Instead of using USDT which requires sudo hipfile will used shared memory to share statistics. |
Motivation
Clients will want some visibility into the behavior of hipfile. This PR adds USDT probes to hipfile and provides an example script to attach to these probes and output statistics after the client program exits. Since this is an experiment there is lots of room for improvement and additional funcitonality.
Technical Details
USDT probes are added to hipfile's IO path. The
ais-stats.pyscript spawns the client process and enables the USDT probes before the client program begins execution. Once the client program terminates,ais-stats.pyoutputs the collected statistics.