[rocprofiler-systems] Add SIGKILL delay option (#2384)

## Motivation

When profiling multi-process applications where a parent process sends SIGKILL to child processes, the termination can occur before the profiler has a chance to flush collected data. This PR introduces a configurable delay before SIGKILL signals are forwarded, allowing profiling data to be captured before process termination. This is workaround.

## Technical Details

- Added new configuration setting `ROCPROFSYS_KILL_DELAY` (default: 0 seconds) to specify a delay before SIGKILL signals are forwarded to other processes
- Implemented `kill_gotcha` component that intercepts the `kill()` system call
- The gotcha only delays SIGKILL signals sent to external processes (pid > 0 and not self)
- Integrated `kill_gotcha_t` into the `preinit_bundle_t` for early initialization
Tento commit je obsažen v:
Milan Radosavljevic
2025-12-23 03:17:57 +01:00
odevzdal GitHub
rodič 37e3b8a3db
revize 719556fbba
7 změnil soubory, kde provedl 157 přidání a 1 odebrání
+19
Zobrazit soubor
@@ -838,6 +838,18 @@ configure_settings(bool _init)
"starting with '_' or containing '::_M'.",
true, "causal", "analysis", "advanced");
ROCPROFSYS_CONFIG_SETTING(int, "ROCPROFSYS_KILL_DELAY",
"Delay (in seconds) before terminating the process "
"after a kill signal is received.",
0, "process", "advanced");
auto kill_delay_config = _config->find("ROCPROFSYS_KILL_DELAY")->second;
auto kill_delay_value = kill_delay_config->get<int>().second;
if(kill_delay_value < 0)
{
kill_delay_config->set(0);
}
// set the defaults
_config->get_flamegraph_output() = false;
_config->get_ctest_notes() = false;
@@ -2556,6 +2568,13 @@ get_caching_perfetto()
return static_cast<tim::tsettings<bool>&>(*_v).get();
}
int
get_kill_delay()
{
static auto _v = get_config()->find("ROCPROFSYS_KILL_DELAY");
return static_cast<tim::tsettings<int>&>(*_v->second).get();
}
tmp_file::tmp_file(std::string _v)
: filename{ std::move(_v) }
{}