[rocprofv3] signal handler fix (#332)

* rocprofv3: LD_PRELOAD for signal and sigaction

- wrappers around `signal` and `sigaction` to prevent applications which install signal handlers to replace the rocprofv3 signal handlers
- minor tweaks to buffer sizes (use page_size instead of
KiB)

* [DO NOT COMMIT] extra logging

* Switch git submodule url for perfetto

- use GitHub URL as this is more accessible

* Update ring_buffer<Tp>

- account for alignment padding

* Update buffered_output

- track number of bytes stored
- add nullptr checks

* Update tmp_file_buffer

- track number of bytes
- read_tmp_file does not create tmp file if it does not already exist

* Update tmp_file

- add exists member function for checking whether temporary file already exists
- tweak remove() implementation

* Update config.hpp

- add option to enable/disable signal handlers
- add option for minimum_output_bytes

* Make signal, sigaction functions visible

* rocprofv3 tool updates

- chained signals
- override the signal handler(s) installed by the application
- improve cleanup of temporary files
- support minimum output bytes

* Add commandline support

* fixing test

* minor fix

* minor fix

* fix clang issue

* fix

* Adding docs

* review comments

* review changes

* review

* YUV pulldown additions to rocdecode

* More rocdecode changes

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Co-authored-by: Jonathan R. Madsen <Jonathan.Madsen@amd.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>
Tento commit je obsažen v:
Nagaraj, Sriraksha
2025-04-17 23:10:52 -05:00
odevzdal GitHub
rodič 46818b0167
revize 87badfbd15
22 změnil soubory, kde provedl 866 přidání a 107 odebrání
+8
Zobrazit soubor
@@ -168,6 +168,10 @@ The following table lists the commonly used ``rocprofv3`` command-line options c
* - Other
- ``--preload`` [PRELOAD ...]
- Specifies libraries to prepend to ``LD_PRELOAD``. It is useful for sanitizer libraries.
- ``--minimum-output-data``
- Output files are generated only if output data size is greater than minimum output data size. It can be used for controlling the generation of output files so that user don't recieve empty files. The input is in KB units.
- ``--disable-signal-handlers``
- Disables the signal handlers in the rocprofv3 tool. It disables the prioritizing of rocprofv3 signal handler over application installed signal handler. When --disable-signal-handlers is set to true, and application has its signal handler on SIGSEGV or similar installed, then its signal handler will be used not the rocprofv3 signal handler. Note: glog still installs signal handlers which provide backtraces.
To see exhaustive list of ``rocprofv3`` options:
@@ -702,6 +706,8 @@ Here is the input schema (properties) of JSON or YAML input files:
- **hsa_finalize_trace** *(boolean)*
- **hsa_image_trace** *(boolean)*
- **sys_trace** *(boolean)*
- **minimum-output-data** *(integer)*
- **disable-signal-handlers** *(boolean)*
- **mangled_kernels** *(boolean)*
- **truncate_kernels** *(boolean)*
- **output_file** *(string)*
@@ -802,6 +808,8 @@ Here is the input schema (properties) of JSON or YAML input files:
- **list_avail** *(boolean)*
- **log_level** *(string)*
- **preload** *(array)*
- **minimum-output-data** *(integer)*
- **disable-signal-handlers** *(boolean)*
- **pc_sampling_unit** *(string)*
- **pc_sampling_method** *(string)*
- **pc_sampling_interval** *(integer)*
+8
Zobrazit soubor
@@ -166,6 +166,14 @@
"type": "array",
"description": "Libraries to prepend to LD_PRELOAD (usually for sanitizers)"
},
"minimum-output-data":{
"type": "integer",
"description": "Minimum output data, the output files are generated only if output data size is greater than minimum output data size. It can be used for controlling the generation of output files so that user don't recieve empty files. The input is in KB units"
},
"disable-signal-handlers":{
"type": "boolean",
"description": "Disables the signal handlers in the rocprofv3 tool. When --disable-signal-handlers is set to true, and application has its signal handler on SIGSEGV or similar installed, then its signal handler will be used not the rocprofv3 signal handler. Note: glog still installs signal handlers which provide backtraces"
},
"pc_sampling_unit": {
"type": "string",
"description": "pc sampling unit"