Skip to content
Open
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
11 changes: 11 additions & 0 deletions rpd_tracer/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ void Logger::init()
if (autostart == 0)
startTracing = false;
}

// Add delay before starting tracing/autoflush if RPDT_DELAY is set
const char *delay_env = getenv("RPDT_DELAY");
if (delay_env != nullptr) {
int delay_sec = atoi(delay_env);
if (delay_sec > 0) {
fprintf(stderr, "rpd_tracer: delaying start by %d seconds (RPDT_DELAY)\n", delay_sec);
sleep(delay_sec);
}
}

if (startTracing == true) {
for (auto it = m_sources.begin(); it != m_sources.end(); ++it)
(*it)->startTracing();
Expand Down
9 changes: 9 additions & 0 deletions rpd_tracer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ This is a tracer that can attach to any process and record hip apis, ops, and ro
init_tracing();
```
<b>Note:</b> You can utilize `nm -gd <PATH_TO_librpd_tracer.so>` to find out symbol names in your library.

<b>Delay Option:</b>
- You can delay the start of profiling/autoflush by setting the environment variable `RPDT_DELAY` to the number of seconds to wait before tracing begins. This is useful for large workloads where you want to skip initial setup time.
- Example usage:
```bash
export RPDT_DELAY=10 # Delay start by 10 seconds
export RPDT_AUTOFLUSH=1
<your launch command>
```