// MIT License // // Copyright (c) 2022-2025 Advanced Micro Devices, Inc. All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #pragma once #define TIMEMORY_PROJECT_NAME "rocprof-sys-causal" #include #include #include #include #include #include #include template void update_env(std::vector& _environ, std::string_view _env_var, Tp&& _env_val, bool _append = false, std::string_view _join_delim = ":"); int get_verbose(); void print_command(const std::vector& _argv, std::string_view); void print_updated_environment(std::vector, std::string_view); std::vector get_initial_environment(); void prepare_command_for_run(char*, std::vector&); void prepare_environment_for_run(std::vector&); std::vector parse_args(int argc, char** argv, std::vector&, std::vector>&); using sigaction_t = struct sigaction; struct signal_handler { sigaction_t m_custom_sigaction = {}; sigaction_t m_original_sigaction = {}; }; void forward_signals(const std::set&); void add_child_pid(pid_t); void remove_child_pid(pid_t); int wait_pid(pid_t, int = 0); int diagnose_status(pid_t, int);