557adea45a
* causal backtrace updates
- fix initial causal sampling period value
* causal delay updates
- tweak handling of sleep_for_overhead
* Fix experiment global scaling for prog pts
- results in drastically improved predictions
* pthread_mutex_gotcha updates
- disable all wrappers during causal profiling
* validate-causal-json.py updates
- support decimal stddev
- fix setting stddev from command-line
* causal perform_experiment_impl update
- handle start failing because finalizing
* deprecate causal::component::sample_rate
- appears to not help at all
* Rework sample info
* Increase causal unwind_depth
- use OMNITRACE_MAX_UNWIND_DEPTH
* validate-causal-json updates
- min experiments
- exclude reporting predictions with less than X experiments at a given speedup
- percent samples
- only print samples within X% of the peak (default: 95%)
* Update timemory submodule
- extensions to sampling for signals delivered via non-timer method
- e.g. via HW counter overflow
* dwarf_entry::operator< updates
- sort via file
* causal profiling docs updates
- info about backends
- info about installing/enabling perf
* config updates: causal backend
- CausalBackend enum
- OMNITRACE_CAUSAL_BACKEND: perf, timer, auto
- omnitrace-causal option: --backend
* debug update
- use spin_mutex instead of std::mutex
* address_range::contains update
- range from 0-100 contains range from 10-100 but was returning false because high was == 100 not < 100
* symbol::operator< update
- handle load address differences
* sampling updates (non-causal)
- update get_timer to get_trigger + dynamic_cast
* container::static_vector updates
- support construction from container::c_array
- update_size private member func for handling atomic m_size
* Move perf files
- moved library/causal/perf.{hpp,cpp} to library/perf.{hpp,cpp}
* causal example update
- created impl.hpp (forward decls)
- renamed {cpu,rng}_func_impl to {cpu,rng}_impl_func
- only create two threads which run N iterations instead of two threads each iteration
* Update timemory submodule
- updates to unwind::processed_entry
- updates to procfs::maps
* Updated causal documentation
- fixed line numbers changed by modifications to causal example
* omnitrace-causal exe updates
- set OMNITRACE_THREAD_POOL_SIZE to zero by default
* core/containers updates
- static_vector: provide data() member function
- c_array pop_front() and pop_back() member functions
* core: config and argparse updates + perf
- core/perf.{hpp,cpp}
- forward decl of enums
- config-related capabilities
- argparse: --sample-overflow
- renamed some config functions
- e.g. get_sampling_cpu_freq -> get_sampling_cputime_freq
- added config settings related to overflow sampling via perf
- added timer_sampling and overflow_sampling categories
* Update timemory submodule
- sampling allocator flushing
* binary updates
- lookup_ipaddr_entry
- use bfd_find_nearest_line instead of bfd_find_nearest_line_discriminator
- discriminators are not used
- explicit instantiations of inlined_symbol::serialize
* Bump VERSION to 1.10.0
* sampling and perf updates
- support overflow sampling via Linux Perf
- update perf namespace
- update perf::perf_event
- update record ctor: pointer instead of const ref
- update open member func: return optional string
- add m_batch_size member variable
- sampling updates
- support overflow sampling
- flush allocators
- increase buffer size from 1024 to 2048
- restructure post-processing in light of perf overflow supports
- improve offload memory usage only load buffers for thread
- load_offload_buffer(tid) uses thread-specific filepos
- component updates
- backtrace_metrics::operator-=
- backtrace_metrics::operator-
- backtrace::sample does not record for overflow signal
- callchain: perf overflow sample
* core updates
- component::sampling_percent does not report self + uses_percent_units
* causal updates
- tweak get_line_info
- overloads for set_current_selection (uint64_t, c_array, std::array)
- delay
- use sampling::pause/sampling::resume
- experiment
- experiment::sample derives from unwind::processed_entry
- experiment::samples is vector instead of set
- fixed samples
- overloads for is_selected (uint64_t, c_array, std::array)
- scaling factor defaults to 100 instead of 50
- serialize updates follow change to experiment::sample
- modify algorithm for increasing/decreasing experiment length
- sample_data
- use map<uintptr, uint64_t> instead of set<sample_data>
- get_samples returns vector<sample_data> instead of set<sample_data>
- sampling
- support overflow via Linux Perf
- update causal_offload_buffer
- flush sampling allocator
- backtrace
- overflow component
* libomnitrace-dl updates
- handle dl::InstrumentMode::PythonProfile
* testing updates (causal)
- causal line 155 -> causal line 100
- causal line 165 -> causal line 110
* formatting
* exit_gotcha updates
- exit_info for abort()
- message about non-zero exit code
* testing updates
- fail regex for causal tests
- validate-causal-json: >= min_experiments instead of > min_experiments
- handle OMNITRACE_DEBUG_SETTINGS in omnitrace_write_test_config
* causal sampling updates
- add new lines where appropriate
* causal data updates
- reorder diagnostic info when experiment fails to start
* binary updates
- symbol address range from address to address + symsize + 1
- add 1 based on debug info
* causal data updates
- sample_selection wait_ns defaults to 1,000 instead of 10,000
- sample_selection wait scaled by iteration number
- save_line_info_impl verbosity
- print latest_eligible_pc when experiment does not start
* causal sampling + component updates
- perf backend disables component::backtrace
- ensure get_sampling_(realtime|cputime|overflow)_signal do not malloc
* causal: remove period stats
* validate-causal-json update
- fix --help
* causal data updates
- improve eligible pc history reporting when experiment fails to start
* causal data updates
- fix compute_eligible_lines_impl
- eligible address ranges returning too many ranges
- occasionally, overwrite all *true* eligible address ranges
* causal data updates
- reduce scoped ranges to symbol ranges
- is_eligible_address() returns true contains (not just coarse)
- revert some sample_selection behavior
* binary address_multirange updates
- make coarse_range private
- fix operator+=(pair<coarse, uintptr_t>)
* causal example update
- fix nsync to default to once per iteration
* binary analysis updates
- tweak header file includes
* causal updates
- remove factoring in sleep_for_overhead
- invoke delay::process() even if experiment is not active
* causal data updates
- update latest_eligible_pc structure
* update omnitrace-install.py.in
- fix support for fedora
- /etc/os-release does not have ID_LIKE
- fallback to RHEL 8.7 if version not specified
* update omnitrace-install.py.in
- fix support for debian
- /etc/os-release does not have ID_LIKE
- version mapping
* Update documentation
- update docs on installation
* causal data and experiment updates
- data: reset_sample_selection
* causal set_current_selection debugging
- debug messages for failed e2e runs
* causal data and backtrace component updates
- data: set_current_selection returns the number of eligible addresses added
- backtrace: if cputime signal has selected zero IPs > 5x, then realtime signal starts contributing call-stacks
* core library updates
- move config::parse_numeric_range to utility namespace
- add core/utility.cpp
- support range:increment, e.g. 5-25:10 expands to '5 15 25' instead of '5 10 15 20 25'
* omnitrace-causal update
- end-to-end expands all speedups
- support range:increment in speedups
* causal backtrace updates
- remove select_ival (realtime signal always contributes when select_count == 0)
* containers: static_vector update
- explicit c_array constructor
- explicit std::array constructor
* causal data updates
- remove set_current_selection(uint64_t)
- remove set_current_selection(std::array)
- sample_selection increase default wait time
- report eligible PC candidates
- move reset_sample_selection to perform_experiment_impl
- decrease latest_eligible_pc array size
- set_current_selection does not guard for experiment::active
* core debug updates
- OMNITRACE_PRINT_COLOR macros
* causal data updates
- tweak to experiment never started message
* causal gotcha updates
- remove unused code
* critical trace updates
- remove unused code
* omnitrace-causal
- OMNITRACE_LAUNCHER
* causal data updates
- don't fail on end-to-end + omnitrace-causal
* causal backtrace updates
- reintroduce select_ival behavior
* causal data updates
- tweak verbose messages about number of PC candidates
* core mproc updates
- utilities for waiting on child PID and diagnosing status
- omnitrace::mproc::wait_pid
- omnitrace::mproc::diagnose_status
* omnitrace-run updates
- support --fork argument for executing via fork in current process + execvpe on child instead of execvpe in current process
* omnitrace-causal updates
- wait_pid and diagnose_status just call equivalent functions in omnitrace::mproc
* ubuntu-focal workflow update
- attempt to launch ubuntu-focal-codecov job with CAP_SYS_ADMIN and use perf backend
* tests reorg and updates
- remove binary-rewrite-sampling and runtime-instrument-sampling tests
- rename *-preload tests (which use omnitrace-sample exe) to *-sampling
- split tests/CMakeLists.txt into several tests/omnitrace-<category>-tests.cmake files
- tweak to causal-both-omni-func test
- add args: -n 2 -b timer
* update validate-causal-json.py
- better reasoning info for adjusting tolerance
- always apply tolerance adjustments in CI mode
* causal e2e tests update
- add label "causal-e2e" label
- tweak params
- old: 80 12 432525 500000000
- new: 80 50 432525 100000000
- disable processor affinity for slow-func/line-100 tests
- artificially inflates some speedups with perf
* unblocking_gotcha updates
- overload operator() according to gotcha function index
* blocking_gotcha updates
- overload operator() according to gotcha function index
- fix bug where potentially post block functors (e.g. pthread_mutex_trylock) throw error if lock is not acquired.
* parse_numeric_range update
- support unordered_set
* config update
- OMNITRACE_DEBUG_{TIDS,PIDS} use parse_numeric_range
[ROCm/rocprofiler-systems commit: 9de3a6b0b4]
1463 γραμμές
56 KiB
C++
1463 γραμμές
56 KiB
C++
// MIT License
|
|
//
|
|
// Copyright (c) 2022 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.
|
|
|
|
#include "argparse.hpp"
|
|
#include "common/join.hpp"
|
|
#include "config.hpp"
|
|
#include "defines.hpp"
|
|
#include "exception.hpp"
|
|
#include "gpu.hpp"
|
|
#include "state.hpp"
|
|
|
|
#include <timemory/settings/types.hpp>
|
|
#include <timemory/utility/filepath.hpp>
|
|
#include <timemory/utility/join.hpp>
|
|
|
|
namespace omnitrace
|
|
{
|
|
namespace argparse
|
|
{
|
|
namespace
|
|
{
|
|
namespace filepath = ::tim::filepath;
|
|
using array_config_t = ::timemory::join::array_config;
|
|
using ::tim::get_env;
|
|
using ::timemory::join::join;
|
|
|
|
auto
|
|
get_clock_id_choices()
|
|
{
|
|
auto clock_name = [](std::string _v) {
|
|
constexpr auto _clock_prefix = std::string_view{ "clock_" };
|
|
for(auto& itr : _v)
|
|
itr = tolower(itr);
|
|
auto _pos = _v.find(_clock_prefix);
|
|
if(_pos == 0) _v = _v.substr(_pos + _clock_prefix.length());
|
|
if(_v == "process_cputime_id") _v = "cputime";
|
|
return _v;
|
|
};
|
|
|
|
#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \
|
|
std::make_tuple(clock_name(#VAL), VAL, std::string_view{ #VAL })
|
|
|
|
auto _choices = strvec_t{};
|
|
auto _aliases = std::map<std::string, strvec_t>{};
|
|
for(auto itr : { OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
|
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
|
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
|
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
|
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
|
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
|
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
|
{
|
|
auto _choice = std::to_string(std::get<1>(itr));
|
|
_choices.emplace_back(_choice);
|
|
_aliases[_choice] = { std::get<0>(itr), std::string{ std::get<2>(itr) } };
|
|
}
|
|
|
|
#undef OMNITRACE_CLOCK_IDENTIFIER
|
|
|
|
return std::make_pair(_choices, _aliases);
|
|
}
|
|
|
|
auto
|
|
get_realpath(const std::string& _path)
|
|
{
|
|
return filepath::realpath(_path, nullptr, false);
|
|
}
|
|
|
|
enum update_mode : int
|
|
{
|
|
UPD_REPLACE = 0x1,
|
|
UPD_PREPEND = 0x2,
|
|
UPD_APPEND = 0x3,
|
|
UPD_WEAK = 0x4,
|
|
};
|
|
|
|
template <typename Tp>
|
|
void
|
|
update_env(parser_data& _data, std::string_view _env_var, Tp&& _env_val,
|
|
update_mode&& _mode = UPD_REPLACE, std::string_view _join_delim = ":")
|
|
{
|
|
_data.updated.emplace(_env_var);
|
|
|
|
auto _prepend = (_mode & UPD_PREPEND) == UPD_PREPEND;
|
|
auto _append = (_mode & UPD_APPEND) == UPD_APPEND;
|
|
auto _weak_upd = (_mode & UPD_WEAK) == UPD_WEAK;
|
|
|
|
auto _key = join("", _env_var, "=");
|
|
for(auto& itr : _data.current)
|
|
{
|
|
if(!itr) continue;
|
|
if(std::string_view{ itr }.find(_key) == 0)
|
|
{
|
|
if(_weak_upd)
|
|
{
|
|
// if the value has changed, do not update but allow overridding the value
|
|
// inherited from the initial env
|
|
if(_data.initial.find(std::string{ itr }) == _data.initial.end()) return;
|
|
}
|
|
|
|
if(_prepend || _append)
|
|
{
|
|
if(std::string_view{ itr }.find(join("", _env_val)) ==
|
|
std::string_view::npos)
|
|
{
|
|
auto _val = std::string{ itr }.substr(_key.length());
|
|
free(itr);
|
|
if(_prepend)
|
|
itr =
|
|
strdup(join('=', _env_var, join(_join_delim, _val, _env_val))
|
|
.c_str());
|
|
else
|
|
itr =
|
|
strdup(join('=', _env_var, join(_join_delim, _env_val, _val))
|
|
.c_str());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
free(itr);
|
|
itr = strdup(omnitrace::common::join('=', _env_var, _env_val).c_str());
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
_data.current.emplace_back(
|
|
strdup(omnitrace::common::join('=', _env_var, _env_val).c_str()));
|
|
}
|
|
|
|
void
|
|
remove_env(parser_data& _data, std::string_view _env_var)
|
|
{
|
|
auto _key = join("", _env_var, "=");
|
|
auto _match = [&_key](auto itr) { return std::string_view{ itr }.find(_key) == 0; };
|
|
|
|
auto& _environ = _data.current;
|
|
_environ.erase(std::remove_if(_environ.begin(), _environ.end(), _match),
|
|
_environ.end());
|
|
|
|
auto& _initial = _data.initial;
|
|
for(const auto& itr : _initial)
|
|
{
|
|
if(std::string_view{ itr }.find(_key) == 0)
|
|
_environ.emplace_back(strdup(itr.c_str()));
|
|
}
|
|
}
|
|
|
|
std::string
|
|
get_internal_libpath(const std::string& _lib)
|
|
{
|
|
auto _exe = filepath::realpath("/proc/self/exe", nullptr, false);
|
|
auto _pos = _exe.find_last_of('/');
|
|
auto _dir = filepath::get_cwd();
|
|
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
|
return filepath::realpath(omnitrace::common::join("/", _dir, "..", "lib", _lib),
|
|
nullptr, false);
|
|
}
|
|
} // namespace
|
|
|
|
bool
|
|
default_setting_filter(vsetting_t* _v, const parser_data& _data)
|
|
{
|
|
return (_data.processed_settings.count(_v) == 0 &&
|
|
_data.processed_environs.count(_v->get_name()) == 0 &&
|
|
_data.processed_environs.count(_v->get_env_name()) == 0);
|
|
}
|
|
|
|
bool
|
|
default_environ_filter(std::string_view _v, const parser_data& _data)
|
|
{
|
|
return (_data.processed_environs.count(_v.data()) == 0);
|
|
}
|
|
|
|
bool
|
|
default_grouping_filter(std::string_view _v, const parser_data& _data)
|
|
{
|
|
return (_data.processed_groups.count(_v.data()) == 0);
|
|
}
|
|
|
|
parser_data&
|
|
init_parser(parser_data& _data)
|
|
{
|
|
tim::settings::suppress_config() = true;
|
|
tim::settings::suppress_parsing() = true;
|
|
|
|
set_state(State::Init);
|
|
config::configure_settings(false);
|
|
|
|
auto& _current = _data.current;
|
|
auto& _initial = _data.initial;
|
|
|
|
if(environ != nullptr)
|
|
{
|
|
int idx = 0;
|
|
while(environ[idx] != nullptr)
|
|
{
|
|
auto* _v = environ[idx++];
|
|
_initial.emplace(_v);
|
|
_current.emplace_back(strdup(_v));
|
|
}
|
|
}
|
|
|
|
_data.dl_libpath = get_realpath(get_internal_libpath("libomnitrace-dl.so").c_str());
|
|
_data.omni_libpath = get_realpath(get_internal_libpath("libomnitrace.so").c_str());
|
|
|
|
#if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER)
|
|
update_env(_data, "HSA_TOOLS_LIB", _data.dl_libpath);
|
|
if(!getenv("HSA_TOOLS_REPORT_LOAD_FAILURE"))
|
|
update_env(_data, "HSA_TOOLS_REPORT_LOAD_FAILURE", "1");
|
|
#endif
|
|
|
|
#if defined(OMNITRACE_USE_ROCPROFILER)
|
|
update_env(_data, "ROCP_TOOL_LIB", _data.omni_libpath);
|
|
if(!getenv("ROCP_HSA_INTERCEPT")) update_env(_data, "ROCP_HSA_INTERCEPT", "1");
|
|
#endif
|
|
|
|
#if defined(OMNITRACE_USE_OMPT)
|
|
if(!getenv("OMP_TOOL_LIBRARIES"))
|
|
update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath, UPD_PREPEND);
|
|
#endif
|
|
|
|
return _data;
|
|
}
|
|
|
|
parser_data&
|
|
add_ld_preload(parser_data& _data)
|
|
{
|
|
update_env(_data, "LD_PRELOAD", _data.dl_libpath, UPD_APPEND);
|
|
return _data;
|
|
}
|
|
|
|
parser_data&
|
|
add_core_arguments(parser_t& _parser, parser_data& _data)
|
|
{
|
|
const auto* _cputime_desc =
|
|
R"(Sample based on a CPU-clock timer (default). Accepts zero or more arguments:
|
|
%{INDENT}%0. Enables sampling based on CPU-clock timer.
|
|
%{INDENT}%1. Interrupts per second. E.g., 100 == sample every 10 milliseconds of CPU-time.
|
|
%{INDENT}%2. Delay (in seconds of CPU-clock time). I.e., how long each thread should wait before taking first sample.
|
|
%{INDENT}%3+ Thread IDs to target for sampling, starting at 0 (the main thread).
|
|
%{INDENT}% May be specified as index or range, e.g., '0 2-4' will be interpreted as:
|
|
%{INDENT}% sample the main thread (0), do not sample the first child thread but sample the 2nd, 3rd, and 4th child threads)";
|
|
|
|
const auto* _realtime_desc =
|
|
R"(Sample based on a real-clock timer. Accepts zero or more arguments:
|
|
%{INDENT}%0. Enables sampling based on real-clock timer.
|
|
%{INDENT}%1. Interrupts per second. E.g., 100 == sample every 10 milliseconds of realtime.
|
|
%{INDENT}%2. Delay (in seconds of real-clock time). I.e., how long each thread should wait before taking first sample.
|
|
%{INDENT}%3+ Thread IDs to target for sampling, starting at 0 (the main thread).
|
|
%{INDENT}% May be specified as index or range, e.g., '0 2-4' will be interpreted as:
|
|
%{INDENT}% sample the main thread (0), do not sample the first child thread but sample the 2nd, 3rd, and 4th child threads
|
|
%{INDENT}% When sampling with a real-clock timer, please note that enabling this will cause threads which are typically "idle"
|
|
%{INDENT}% to consume more resources since, while idle, the real-clock time increases (and therefore triggers taking samples)
|
|
%{INDENT}% whereas the CPU-clock time does not.)";
|
|
|
|
const auto* _overflow_desc =
|
|
R"(Sample based on an overflow event. Accepts zero or more arguments:
|
|
%{INDENT}%0. Enables sampling based on overflow.
|
|
%{INDENT}%1. Overflow metric, e.g. PERF_COUNT_HW_INSTRUCTIONS
|
|
%{INDENT}%2. Overflow value. E.g., if metric == PERF_COUNT_HW_INSTRUCTIONS, then 10000000 == sample every 10,000,000 instructions.
|
|
%{INDENT}%3+ Thread IDs to target for sampling, starting at 0 (the main thread).
|
|
%{INDENT}% May be specified as index or range, e.g., '0 2-4' will be interpreted as:
|
|
%{INDENT}% sample the main thread (0), do not sample the first child thread but sample the 2nd, 3rd, and 4th child threads)";
|
|
|
|
const auto* _hsa_interrupt_desc =
|
|
R"(Set the value of the HSA_ENABLE_INTERRUPT environment variable.
|
|
%{INDENT}% ROCm version 5.2 and older have a bug which will cause a deadlock if a sample is taken while waiting for the signal
|
|
%{INDENT}% that a kernel completed -- which happens when sampling with a real-clock timer. We require this option to be set to
|
|
%{INDENT}% when --realtime is specified to make users aware that, while this may fix the bug, it can have a negative impact on
|
|
%{INDENT}% performance.
|
|
%{INDENT}% Values:
|
|
%{INDENT}% 0 avoid triggering the bug, potentially at the cost of reduced performance
|
|
%{INDENT}% 1 do not modify how ROCm is notified about kernel completion)";
|
|
|
|
auto _realtime_reqs =
|
|
(tim::get_env("HSA_ENABLE_INTERRUPT", std::string{}, false).empty())
|
|
? strvec_t{ "hsa-interrupt" }
|
|
: strvec_t{};
|
|
|
|
#if OMNITRACE_USE_ROCTRACER == 0 && OMNITRACE_USE_ROCPROFILER == 0
|
|
_realtime_reqs.clear();
|
|
#endif
|
|
|
|
const auto* _trace_policy_desc =
|
|
R"(Policy for new data when the buffer size limit is reached:
|
|
%{INDENT}%- discard : new data is ignored
|
|
%{INDENT}%- ring_buffer : new data overwrites oldest data)";
|
|
|
|
_parser.start_group("DEBUG OPTIONS", "");
|
|
|
|
if(_data.environ_filter("monochrome", _data))
|
|
{
|
|
_parser.add_argument({ "--monochrome" }, "Disable colorized output")
|
|
.max_count(1)
|
|
.dtype("bool")
|
|
.action([&](parser_t& p) {
|
|
auto _monochrome = p.get<bool>("monochrome");
|
|
_data.monochrome = _monochrome;
|
|
p.set_use_color(!_monochrome);
|
|
update_env(_data, "OMNITRACE_MONOCHROME", (_monochrome) ? "1" : "0");
|
|
update_env(_data, "MONOCHROME", (_monochrome) ? "1" : "0");
|
|
});
|
|
|
|
_data.processed_environs.emplace("monochrome");
|
|
}
|
|
|
|
if(_data.environ_filter("debug", _data))
|
|
{
|
|
_parser.add_argument({ "--debug" }, "Debug output")
|
|
.max_count(1)
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_DEBUG", p.get<bool>("debug"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("debug");
|
|
}
|
|
|
|
if(_data.environ_filter("verbose", _data))
|
|
{
|
|
_parser.add_argument({ "-v", "--verbose" }, "Verbose output")
|
|
.count(1)
|
|
.dtype("integral")
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<int>("verbose");
|
|
_data.verbose = _v;
|
|
update_env(_data, "OMNITRACE_VERBOSE", _v);
|
|
});
|
|
|
|
_data.processed_environs.emplace("verbose");
|
|
}
|
|
|
|
add_group_arguments(_parser, "debugging", _data);
|
|
add_group_arguments(_parser, "mode", _data, true);
|
|
|
|
_parser.start_group("GENERAL OPTIONS",
|
|
"These are options which are ubiquitously applied");
|
|
|
|
if(_data.environ_filter("config", _data))
|
|
{
|
|
_parser.add_argument({ "-c", "--config" }, "Configuration file")
|
|
.min_count(1)
|
|
.dtype("filepath")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_CONFIG_FILE",
|
|
join(array_config_t{ ":" }, p.get<strvec_t>("config")));
|
|
});
|
|
|
|
_data.processed_environs.emplace("config");
|
|
_data.processed_environs.emplace("config_file");
|
|
}
|
|
|
|
if(_data.environ_filter("output", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-o", "--output" },
|
|
"Output path. Accepts 1-2 parameters corresponding to the output "
|
|
"path and the output prefix")
|
|
.min_count(1)
|
|
.max_count(2)
|
|
.dtype("path [prefix]")
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<strvec_t>("output");
|
|
update_env(_data, "OMNITRACE_OUTPUT_PATH", _v.at(0));
|
|
if(_v.size() > 1) update_env(_data, "OMNITRACE_OUTPUT_PREFIX", _v.at(1));
|
|
});
|
|
|
|
_data.processed_environs.emplace("output");
|
|
_data.processed_environs.emplace("output_path");
|
|
_data.processed_environs.emplace("output_prefix");
|
|
}
|
|
|
|
if(_data.environ_filter("trace", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-T", "--trace" },
|
|
"Generate a detailed trace (perfetto output)")
|
|
.max_count(1)
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_USE_PERFETTO", p.get<bool>("trace"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace");
|
|
}
|
|
|
|
if(_data.environ_filter("profile", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-P", "--profile" },
|
|
"Generate a call-stack-based profile (conflicts with --flat-profile)")
|
|
.max_count(1)
|
|
.conflicts({ "flat-profile" })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_USE_TIMEMORY", p.get<bool>("profile"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("profile");
|
|
}
|
|
|
|
if(_data.environ_filter("flat_profile", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-F", "--flat-profile" },
|
|
"Generate a flat profile (conflicts with --profile)")
|
|
.max_count(1)
|
|
.conflicts({ "profile" })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_USE_TIMEMORY", p.get<bool>("flat-profile"));
|
|
update_env(_data, "OMNITRACE_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("flat_profile");
|
|
}
|
|
|
|
if(_data.environ_filter("sampling", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-S", "--sample" },
|
|
"Enable statistical sampling of call-stack")
|
|
.min_count(0)
|
|
.max_count(2)
|
|
.dtype("timer-type")
|
|
.choices({ "cputime", "realtime" })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_USE_SAMPLING", true);
|
|
auto _modes = p.get<strset_t>("sample");
|
|
if(!_modes.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME",
|
|
_modes.count("cputime") > 0, UPD_WEAK);
|
|
update_env(_data, "OMNITRACE_SAMPLING_REALTIME",
|
|
_modes.count("realtime") > 0, UPD_WEAK);
|
|
}
|
|
});
|
|
|
|
_data.processed_environs.emplace("cpu_freq");
|
|
}
|
|
|
|
if(_data.environ_filter("host", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-H", "--host" },
|
|
"Enable sampling host-based metrics for the process. E.g. CPU "
|
|
"frequency, memory usage, etc.")
|
|
.max_count(1)
|
|
.action([&](parser_t& p) {
|
|
auto _h = p.get<bool>("host");
|
|
auto _d = p.get<bool>("device");
|
|
update_env(_data, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
|
update_env(_data, "OMNITRACE_CPU_FREQ_ENABLED", _h);
|
|
});
|
|
|
|
_data.processed_environs.emplace("host");
|
|
_data.processed_environs.emplace("cpu_freq");
|
|
}
|
|
|
|
if(_data.environ_filter("device", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-D", "--device" },
|
|
"Enable sampling device-based metrics for the process. E.g. GPU "
|
|
"temperature, memory usage, etc.")
|
|
.max_count(1)
|
|
.action([&](parser_t& p) {
|
|
auto _h = p.get<bool>("host");
|
|
auto _d = p.get<bool>("device");
|
|
update_env(_data, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
|
update_env(_data, "OMNITRACE_USE_ROCM_SMI", _d);
|
|
});
|
|
|
|
_data.processed_environs.emplace("device");
|
|
_data.processed_environs.emplace("rocm_smi");
|
|
}
|
|
|
|
if(_data.environ_filter("wait", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-w", "--wait" },
|
|
"This option is a combination of '--trace-wait' and "
|
|
"'--sampling-wait'. See the descriptions for those two options.")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_TRACE_DELAY", p.get<double>("wait"),
|
|
UPD_WEAK);
|
|
update_env(_data, "OMNITRACE_SAMPLING_DELAY", p.get<double>("wait"),
|
|
UPD_WEAK);
|
|
update_env(_data, "OMNITRACE_CAUSAL_DELAY", p.get<double>("wait"),
|
|
UPD_WEAK);
|
|
});
|
|
|
|
_data.processed_environs.emplace("wait");
|
|
}
|
|
|
|
if(_data.environ_filter("duration", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-d", "--duration" },
|
|
"This option is a combination of '--trace-duration' and "
|
|
"'--sampling-duration'. See the descriptions for those two options.")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_TRACE_DURATION", p.get<double>("duration"),
|
|
UPD_WEAK);
|
|
update_env(_data, "OMNITRACE_SAMPLING_DURATION",
|
|
p.get<double>("duration"), UPD_WEAK);
|
|
update_env(_data, "OMNITRACE_CAUSAL_DURATION", p.get<double>("duration"),
|
|
UPD_WEAK);
|
|
});
|
|
|
|
_data.processed_environs.emplace("duration");
|
|
}
|
|
|
|
if(_data.environ_filter("periods", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "--periods" },
|
|
"Similar to specifying delay and/or duration except in "
|
|
"the form <DELAY>:<DURATION>, <DELAY>:<DURATION>:<REPEAT>, "
|
|
"and/or <DELAY>:<DURATION>:<REPEAT>:<CLOCK_ID>")
|
|
.min_count(1)
|
|
.dtype("period-spec(s)")
|
|
.action([&](parser_t& p) {
|
|
update_env(
|
|
_data, "OMNITRACE_TRACE_PERIODS",
|
|
join(array_config_t{ " ", "", "" }, p.get<strvec_t>("periods")),
|
|
UPD_WEAK);
|
|
});
|
|
|
|
_data.processed_environs.emplace("periods");
|
|
}
|
|
|
|
strset_t _backend_choices = { "all", "kokkosp", "mpip", "ompt",
|
|
"rcclp", "rocm-smi", "roctracer", "rocprofiler",
|
|
"roctx", "mutex-locks", "spin-locks", "rw-locks" };
|
|
|
|
#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS)
|
|
_backend_choices.erase("mpip");
|
|
#endif
|
|
|
|
#if !defined(OMNITRACE_USE_OMPT)
|
|
_backend_choices.erase("ompt");
|
|
#endif
|
|
|
|
#if !defined(OMNITRACE_USE_RCCL)
|
|
_backend_choices.erase("rcclp");
|
|
#endif
|
|
|
|
#if !defined(OMNITRACE_USE_ROCM_SMI)
|
|
_backend_choices.erase("rocm-smi");
|
|
#endif
|
|
|
|
#if !defined(OMNITRACE_USE_ROCTRACER)
|
|
_backend_choices.erase("roctracer");
|
|
_backend_choices.erase("roctx");
|
|
#endif
|
|
|
|
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
|
_backend_choices.erase("rocprofiler");
|
|
#endif
|
|
|
|
if(gpu::device_count() == 0)
|
|
{
|
|
_backend_choices.erase("rcclp");
|
|
_backend_choices.erase("rocm-smi");
|
|
_backend_choices.erase("roctracer");
|
|
_backend_choices.erase("rocprofiler");
|
|
|
|
#if defined(OMNITRACE_USE_RCCL)
|
|
update_env(_data, "OMNITRACE_USE_RCCLP", false);
|
|
#endif
|
|
|
|
#if defined(OMNITRACE_USE_ROCM_SMI)
|
|
update_env(_data, "OMNITRACE_USE_ROCM_SMI", false);
|
|
#endif
|
|
|
|
#if defined(OMNITRACE_USE_ROCTRACER)
|
|
update_env(_data, "OMNITRACE_USE_ROCTRACER", false);
|
|
update_env(_data, "OMNITRACE_USE_ROCTX", false);
|
|
update_env(_data, "OMNITRACE_ROCTRACER_HSA_ACTIVITY", false);
|
|
update_env(_data, "OMNITRACE_ROCTRACER_HIP_ACTIVITY", false);
|
|
_backend_choices.erase("roctracer");
|
|
_backend_choices.erase("roctx");
|
|
#endif
|
|
|
|
#if defined(OMNITRACE_USE_ROCPROFILER)
|
|
update_env(_data, "OMNITRACE_USE_ROCPROFILER", false);
|
|
#endif
|
|
}
|
|
|
|
_parser.start_group("BACKEND OPTIONS",
|
|
"These options control region information captured "
|
|
"w/o sampling or instrumentation");
|
|
|
|
if(_data.environ_filter("include", _data))
|
|
{
|
|
_parser.add_argument({ "-I", "--include" }, "Include data from these backends")
|
|
.min_count(1)
|
|
.max_count(_backend_choices.size())
|
|
.dtype("[backend...]")
|
|
.choices(_backend_choices)
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<strset_t>("include");
|
|
auto _update = [&](const auto& _opt, bool _cond) {
|
|
if(_cond || _v.count("all") > 0) update_env(_data, _opt, true);
|
|
};
|
|
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
|
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
|
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
|
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
|
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
|
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
|
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
|
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
|
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
|
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
|
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
|
|
|
if(_v.count("all") > 0 || _v.count("ompt") > 0)
|
|
update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath,
|
|
UPD_PREPEND);
|
|
|
|
if(_v.count("all") > 0 || _v.count("kokkosp") > 0)
|
|
update_env(_data, "KOKKOS_PROFILE_LIBRARY", _data.omni_libpath,
|
|
UPD_PREPEND);
|
|
});
|
|
|
|
_data.processed_environs.emplace("include");
|
|
}
|
|
|
|
if(_data.environ_filter("exclude", _data))
|
|
{
|
|
_parser.add_argument({ "-E", "--exclude" }, "Exclude data from these backends")
|
|
.min_count(1)
|
|
.max_count(_backend_choices.size())
|
|
.dtype("[backend...]")
|
|
.choices(_backend_choices)
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<strset_t>("exclude");
|
|
auto _update = [&](const auto& _opt, bool _cond) {
|
|
if(_cond || _v.count("all") > 0) update_env(_data, _opt, false);
|
|
};
|
|
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
|
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
|
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
|
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
|
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
|
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
|
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
|
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
|
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
|
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
|
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
|
|
|
if(_v.count("all") > 0 ||
|
|
(_v.count("roctracer") > 0 && _v.count("rocprofiler") > 0))
|
|
{
|
|
remove_env(_data, "HSA_TOOLS_LIB");
|
|
remove_env(_data, "HSA_TOOLS_REPORT_LOAD_FAILURE");
|
|
}
|
|
|
|
if(_v.count("all") > 0 || _v.count("rocprofiler") > 0)
|
|
{
|
|
remove_env(_data, "ROCP_TOOL_LIB");
|
|
remove_env(_data, "ROCP_HSA_INTERCEPT");
|
|
}
|
|
|
|
if(_v.count("all") > 0 || _v.count("ompt") > 0)
|
|
remove_env(_data, "OMP_TOOL_LIBRARIES");
|
|
|
|
if(_v.count("all") > 0 || _v.count("kokkosp") > 0)
|
|
remove_env(_data, "KOKKOS_PROFILE_LIBRARY");
|
|
});
|
|
|
|
_data.processed_environs.emplace("exclude");
|
|
}
|
|
|
|
add_group_arguments(_parser, "backend", _data);
|
|
add_group_arguments(_parser, "parallelism", _data, true);
|
|
|
|
if(_data.environ_filter("launcher", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-l", "--launcher" },
|
|
"When running MPI jobs, typically the associated '--' for this "
|
|
"executable should be right before the target executable, e.g. `mpirun "
|
|
"-n 2 <THIS_EXE> -- <TARGET_EXE> <TARGET_EXE_ARGS...>`. This options "
|
|
"enables prefixing the entire command (i.e. before `mpirun`, `srun`, "
|
|
"etc.). Pass the name of the target executable (or a regex for matching "
|
|
"to the name of the target) as the argument to this option and this "
|
|
"executable will insert itself a second time in the appropriate "
|
|
"location, e.g. `<THIS_EXE> --launcher sleep -- mpirun -n 2 sleep 10` is "
|
|
"equivalent to `mpirun -n 2 <THIS_EXE> -- sleep 10`")
|
|
.count(1)
|
|
.dtype("target-exe")
|
|
.action(
|
|
[&](parser_t& p) { _data.launcher = p.get<std::string>("launcher"); });
|
|
|
|
_data.processed_environs.emplace("launcher");
|
|
}
|
|
|
|
_parser.start_group("TRACING OPTIONS", "Specific options controlling tracing (i.e. "
|
|
"deterministic measurements of every event)");
|
|
|
|
if(_data.environ_filter("trace_file", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--trace-file" },
|
|
"Specify the trace output filename. Relative filepath will be with "
|
|
"respect to output path and output prefix.")
|
|
.count(1)
|
|
.dtype("filepath")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_PERFETTO_FILE",
|
|
p.get<std::string>("trace-file"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace_file");
|
|
_data.processed_environs.emplace("perfetto_file");
|
|
}
|
|
|
|
if(_data.environ_filter("trace_buffer_size", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "--trace-buffer-size" },
|
|
"Size limit for the trace output (in KB)")
|
|
.count(1)
|
|
.dtype("KB")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_PERFETTO_BUFFER_SIZE_KB",
|
|
p.get<int64_t>("trace-buffer-size"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace_buffer_size");
|
|
_data.processed_environs.emplace("perfetto_buffer_size_kb");
|
|
}
|
|
|
|
if(_data.environ_filter("trace_fill_policy", _data))
|
|
{
|
|
_parser.add_argument({ "--trace-fill-policy" }, _trace_policy_desc)
|
|
.count(1)
|
|
.dtype("policy")
|
|
.choices({ "discard", "ring_buffer" })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_PERFETTO_FILL_POLICY",
|
|
p.get<std::string>("trace-fill-policy"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace_fill_policy");
|
|
_data.processed_environs.emplace("perfetto_fill_policy");
|
|
}
|
|
|
|
if(_data.environ_filter("trace_wait", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--trace-wait" },
|
|
"Set the wait time (in seconds) "
|
|
"before collecting trace and/or profiling data"
|
|
"(in seconds). By default, the duration is in seconds of realtime "
|
|
"but that can changed via --trace-clock-id.")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_TRACE_DELAY", p.get<double>("trace-wait"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace_delay");
|
|
}
|
|
|
|
if(_data.environ_filter("trace_duration", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--trace-duration" },
|
|
"Set the duration of the trace and/or profile data collection (in "
|
|
"seconds). By default, the duration is in seconds of realtime but "
|
|
"that can changed via --trace-clock-id.")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_TRACE_DURATION",
|
|
p.get<double>("trace-duration"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace_duration");
|
|
}
|
|
|
|
if(_data.environ_filter("trace_periods", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--trace-periods" },
|
|
"More powerful version of specifying trace delay and/or duration. Format "
|
|
"is one or more groups of: <DELAY>:<DURATION>, "
|
|
"<DELAY>:<DURATION>:<REPEAT>, "
|
|
"and/or <DELAY>:<DURATION>:<REPEAT>:<CLOCK_ID>.")
|
|
.min_count(1)
|
|
.dtype("period-spec(s)")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_TRACE_PERIODS",
|
|
join(array_config_t{ ",", "", "" },
|
|
p.get<strvec_t>("trace-periods")));
|
|
});
|
|
|
|
_data.processed_environs.emplace("trace_periods");
|
|
}
|
|
|
|
if(_data.environ_filter("trace_clock_id", _data))
|
|
{
|
|
auto _clock_id_choices = get_clock_id_choices();
|
|
_parser
|
|
.add_argument(
|
|
{ "--trace-clock-id" },
|
|
"Set the default clock ID for for trace delay/duration. Note: "
|
|
"\"cputime\" is "
|
|
"the *process* CPU time and might need to be scaled based on the number "
|
|
"of "
|
|
"threads, i.e. 4 seconds of CPU-time for an application with 4 fully "
|
|
"active "
|
|
"threads would equate to ~1 second of realtime. If this proves to be "
|
|
"difficult to handle in practice, please file a feature request for "
|
|
"omnitrace to auto-scale based on the number of threads.")
|
|
.count(1)
|
|
.dtype("clock-id")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_TRACE_PERIOD_CLOCK_ID",
|
|
p.get<double>("trace-clock-id"));
|
|
})
|
|
.choices(_clock_id_choices.first)
|
|
.choice_aliases(_clock_id_choices.second);
|
|
|
|
_data.processed_environs.emplace("trace_clock_id");
|
|
_data.processed_environs.emplace("trace_period_clock_id");
|
|
}
|
|
|
|
_parser.start_group("PROFILE OPTIONS",
|
|
"Specific options controlling profiling (i.e. deterministic "
|
|
"measurements which are aggregated into a summary)");
|
|
|
|
if(_data.environ_filter("profile_format", _data))
|
|
{
|
|
_parser.add_argument({ "--profile-format" }, "Data formats for profiling results")
|
|
.min_count(1)
|
|
.max_count(3)
|
|
.dtype("string")
|
|
.requires({ "profile|flat-profile" })
|
|
.choices({ "text", "json", "console" })
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<strset_t>("profile-format");
|
|
update_env(_data, "OMNITRACE_USE_TIMEMORY", true);
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_TEXT_OUTPUT", _v.count("text") != 0);
|
|
update_env(_data, "OMNITRACE_JSON_OUTPUT", _v.count("json") != 0);
|
|
update_env(_data, "OMNITRACE_COUT_OUTPUT", _v.count("console") != 0);
|
|
}
|
|
});
|
|
|
|
_data.processed_environs.emplace("profile_format");
|
|
_data.processed_environs.emplace("text_output");
|
|
_data.processed_environs.emplace("json_output");
|
|
_data.processed_environs.emplace("cout_output");
|
|
}
|
|
|
|
if(_data.environ_filter("profile_diff", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--profile-diff" },
|
|
"Generate a diff output b/t the profile collected and an existing "
|
|
"profile from another run Accepts 1-2 parameters corresponding to "
|
|
"the input path and the input prefix")
|
|
.min_count(1)
|
|
.max_count(2)
|
|
.dtype("path [prefix]")
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<strvec_t>("profile-diff");
|
|
update_env(_data, "OMNITRACE_DIFF_OUTPUT", true);
|
|
update_env(_data, "OMNITRACE_INPUT_PATH", _v.at(0));
|
|
if(_v.size() > 1) update_env(_data, "OMNITRACE_INPUT_PREFIX", _v.at(1));
|
|
});
|
|
|
|
_data.processed_environs.emplace("profile_diff");
|
|
_data.processed_environs.emplace("diff_output");
|
|
_data.processed_environs.emplace("input_path");
|
|
_data.processed_environs.emplace("input_prefix");
|
|
}
|
|
|
|
_parser.start_group(
|
|
"HOST/DEVICE (PROCESS SAMPLING) OPTIONS",
|
|
"Process sampling is background measurements for resources available to the "
|
|
"entire process. These samples are not tied to specific lines/regions of code");
|
|
|
|
if(_data.environ_filter("process_freq", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "--process-freq" },
|
|
"Set the default host/device sampling frequency "
|
|
"(number of interrupts per second)")
|
|
.count(1)
|
|
.dtype("floating-point")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_PROCESS_SAMPLING_FREQ",
|
|
p.get<double>("process-freq"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("process_freq");
|
|
_data.processed_environs.emplace("process_sampling_freq");
|
|
}
|
|
|
|
if(_data.environ_filter("process_wait", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "--process-wait" }, "Set the default wait time (i.e. delay) "
|
|
"before taking first host/device sample "
|
|
"(in seconds of realtime)")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_PROCESS_SAMPLING_DELAY",
|
|
p.get<double>("process-wait"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("process_wait");
|
|
_data.processed_environs.emplace("process_sampling_delay");
|
|
}
|
|
|
|
if(_data.environ_filter("process_duration", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--process-duration" },
|
|
"Set the duration of the host/device sampling (in seconds of realtime)")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_PROCESS_DURATION",
|
|
p.get<double>("process-duration"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("process_duration");
|
|
_data.processed_environs.emplace("process_sampling_duration");
|
|
}
|
|
|
|
if(_data.environ_filter("cpus", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--cpus" },
|
|
"CPU IDs for frequency sampling. Supports integers and/or ranges")
|
|
.dtype("int and/or range")
|
|
.requires({ "host" })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_CPUS",
|
|
join(array_config_t{ "," }, p.get<strvec_t>("cpus")));
|
|
});
|
|
|
|
_data.processed_environs.emplace("cpus");
|
|
_data.processed_environs.emplace("sampling_cpus");
|
|
}
|
|
|
|
if(_data.environ_filter("gpus", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "--gpus" },
|
|
"GPU IDs for SMI queries. Supports integers and/or ranges")
|
|
.dtype("int and/or range")
|
|
.requires({ "device" })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_GPUS",
|
|
join(array_config_t{ "," }, p.get<strvec_t>("gpus")));
|
|
});
|
|
|
|
_data.processed_environs.emplace("gpus");
|
|
_data.processed_environs.emplace("sampling_gpus");
|
|
}
|
|
|
|
_parser.start_group("GENERAL SAMPLING OPTIONS",
|
|
"General options for timer-based sampling per-thread");
|
|
|
|
if(_data.environ_filter("sampling_freq", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-f", "--sampling-freq" },
|
|
"Set the default sampling frequency "
|
|
"(number of interrupts per second)")
|
|
.count(1)
|
|
.dtype("floating-point")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_FREQ",
|
|
p.get<double>("sampling-freq"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("sampling_freq");
|
|
}
|
|
|
|
if(_data.environ_filter("tids", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "-t", "--tids" },
|
|
"Specify the default thread IDs for sampling, where 0 (zero) is "
|
|
"the main thread and each thread created by the target application "
|
|
"is assigned an atomically incrementing value.")
|
|
.min_count(1)
|
|
.dtype("int and/or range")
|
|
.action([&](parser_t& p) {
|
|
update_env(
|
|
_data, "OMNITRACE_SAMPLING_TIDS",
|
|
join(array_config_t{ ", " }, p.get<std::vector<int64_t>>("tids")));
|
|
});
|
|
|
|
_data.processed_environs.emplace("tids");
|
|
_data.processed_environs.emplace("sampling_tids");
|
|
}
|
|
|
|
if(_data.environ_filter("sampling_wait", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--sampling-wait" },
|
|
"Set the default wait time (i.e. delay) before taking first sample "
|
|
"(in seconds). This delay time is based on the clock of the sampler, "
|
|
"i.e., a "
|
|
"delay of 1 second for CPU-clock sampler may not equal 1 second of "
|
|
"realtime")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_DELAY",
|
|
p.get<double>("sampling-wait"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("sampling_wait");
|
|
_data.processed_environs.emplace("sampling_delay");
|
|
}
|
|
|
|
if(_data.environ_filter("sampling_duration", _data))
|
|
{
|
|
_parser
|
|
.add_argument(
|
|
{ "--sampling-duration" },
|
|
"Set the duration of the sampling (in seconds of realtime). I.e., it is "
|
|
"possible (currently) to set a CPU-clock time delay that exceeds the "
|
|
"real-time duration... resulting in zero samples being taken")
|
|
.count(1)
|
|
.dtype("seconds")
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_DURATION",
|
|
p.get<double>("sampling-duration"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("sampling_duration");
|
|
}
|
|
|
|
_parser.start_group(
|
|
"SAMPLING TIMER OPTIONS",
|
|
"These options determine the heuristic for deciding when to take a sample");
|
|
|
|
if(_data.environ_filter("sampling_cputime", _data))
|
|
{
|
|
_parser.add_argument({ "--sample-cputime" }, _cputime_desc)
|
|
.min_count(0)
|
|
.dtype("[freq] [delay] [tids...]")
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<std::deque<std::string>>("sample-cputime");
|
|
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME", true);
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_FREQ", _v.front());
|
|
_v.pop_front();
|
|
}
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_DELAY", _v.front());
|
|
_v.pop_front();
|
|
}
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_TIDS",
|
|
join(array_config_t{ "," }, _v));
|
|
}
|
|
});
|
|
|
|
_data.processed_environs.emplace("sampling_cputime");
|
|
}
|
|
|
|
if(_data.environ_filter("sampling_realtime", _data))
|
|
{
|
|
_parser.add_argument({ "--sample-realtime" }, _realtime_desc)
|
|
.min_count(0)
|
|
.dtype("[freq] [delay] [tids...]")
|
|
.requires(std::move(_realtime_reqs))
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<std::deque<std::string>>("sample-realtime");
|
|
update_env(_data, "OMNITRACE_SAMPLING_REALTIME", true);
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_FREQ", _v.front());
|
|
_v.pop_front();
|
|
}
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_DELAY", _v.front());
|
|
_v.pop_front();
|
|
}
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_TIDS",
|
|
join(array_config_t{ "," }, _v));
|
|
}
|
|
});
|
|
|
|
_data.processed_environs.emplace("sampling_realtime");
|
|
}
|
|
|
|
if(_data.environ_filter("sampling_overflow", _data))
|
|
{
|
|
_parser.add_argument({ "--sample-overflow" }, _overflow_desc)
|
|
.min_count(0)
|
|
.dtype("[event] [freq] [tids...]")
|
|
.action([&](parser_t& p) {
|
|
auto _v = p.get<std::deque<std::string>>("sample-overflow");
|
|
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW", true);
|
|
|
|
if(!_v.empty())
|
|
{
|
|
if(p.exists("sampling-overflow-event") &&
|
|
_v.front() != p.get<std::string>("sampling-overflow-event"))
|
|
throw exception<std::runtime_error>(join(
|
|
"", "'--sample-overflow ", _v.front(),
|
|
" ...' conflicts with '--sampling-overflow-event ",
|
|
p.get<std::string>("sampling-overflow-event"), "' option"));
|
|
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_EVENT", _v.front());
|
|
_v.pop_front();
|
|
}
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_FREQ", _v.front());
|
|
_v.pop_front();
|
|
}
|
|
if(!_v.empty())
|
|
{
|
|
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_TIDS",
|
|
join(array_config_t{ "," }, _v));
|
|
}
|
|
});
|
|
|
|
_data.processed_environs.emplace("sampling_overflow");
|
|
}
|
|
|
|
_parser.start_group(
|
|
"ADVANCED SAMPLING OPTIONS",
|
|
"These options determine the heuristic for deciding when to take a sample");
|
|
|
|
add_group_arguments(_parser, "sampling", _data);
|
|
|
|
_parser.start_group("HARDWARE COUNTER OPTIONS", "See also: omnitrace-avail -H");
|
|
|
|
if(_data.environ_filter("cpu_events", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-C", "--cpu-events" },
|
|
"Set the CPU hardware counter events to record (ref: "
|
|
"`omnitrace-avail -H -c CPU`)")
|
|
.min_count(1)
|
|
.dtype("[EVENT ...]")
|
|
.action([&](parser_t& p) {
|
|
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("cpu-events"));
|
|
update_env(_data, "OMNITRACE_PAPI_EVENTS", _events);
|
|
});
|
|
|
|
_data.processed_environs.emplace("cpu_events");
|
|
_data.processed_environs.emplace("papi_events");
|
|
}
|
|
|
|
#if defined(OMNITRACE_USE_ROCPROFILER)
|
|
if(_data.environ_filter("gpu_events", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-G", "--gpu-events" },
|
|
"Set the GPU hardware counter events to record (ref: "
|
|
"`omnitrace-avail -H -c GPU`)")
|
|
.min_count(1)
|
|
.dtype("[EVENT ...]")
|
|
.action([&](parser_t& p) {
|
|
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("gpu-events"));
|
|
update_env(_data, "OMNITRACE_ROCM_EVENTS", _events);
|
|
});
|
|
|
|
_data.processed_environs.emplace("gpu_events");
|
|
_data.processed_environs.emplace("rocm_events");
|
|
}
|
|
#endif
|
|
|
|
add_group_arguments(_parser, "category", _data, true);
|
|
add_group_arguments(_parser, "io", _data, true);
|
|
add_group_arguments(_parser, "perfetto", _data, true);
|
|
add_group_arguments(_parser, "timemory", _data, true);
|
|
add_group_arguments(_parser, "rocm", _data, true);
|
|
add_group_arguments(_parser, "critical_trace", _data, true);
|
|
|
|
_parser.start_group("MISCELLANEOUS OPTIONS", "");
|
|
|
|
if(_data.environ_filter("inlines", _data))
|
|
{
|
|
_parser
|
|
.add_argument({ "-i", "--inlines" },
|
|
"Include inline info in output when available")
|
|
.max_count(1)
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "OMNITRACE_SAMPLING_INCLUDE_INLINES",
|
|
p.get<bool>("inlines"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("inlines");
|
|
_data.processed_environs.emplace("sampling_include_inlines");
|
|
}
|
|
|
|
if(_data.environ_filter("hsa_interrupt", _data))
|
|
{
|
|
_parser.add_argument({ "--hsa-interrupt" }, _hsa_interrupt_desc)
|
|
.count(1)
|
|
.dtype("int")
|
|
.choices({ 0, 1 })
|
|
.action([&](parser_t& p) {
|
|
update_env(_data, "HSA_ENABLE_INTERRUPT", p.get<int>("hsa-interrupt"));
|
|
});
|
|
|
|
_data.processed_environs.emplace("hsa_interrupt");
|
|
}
|
|
|
|
_parser.end_group();
|
|
|
|
return _data;
|
|
}
|
|
|
|
parser_data&
|
|
add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_data& _data,
|
|
bool _add_group)
|
|
{
|
|
if(!_data.grouping_filter(_group_name, _data)) return _data;
|
|
|
|
auto _get_name = [](const std::shared_ptr<tim::vsettings>& itr) {
|
|
auto _name = itr->get_name();
|
|
auto _pos = std::string::npos;
|
|
while((_pos = _name.find('_')) != std::string::npos)
|
|
_name = _name.replace(_pos, 1, "-");
|
|
return _name;
|
|
};
|
|
|
|
auto _add_option = [&_parser, &_data](const std::string& _name,
|
|
const std::shared_ptr<tim::vsettings>& itr) {
|
|
if(!_data.setting_filter(itr.get(), _data)) return false;
|
|
|
|
if(_name.empty())
|
|
throw exception<std::runtime_error>("Error! empty name for " +
|
|
itr->get_name());
|
|
|
|
_data.processed_settings.emplace(itr.get());
|
|
|
|
auto _opt_name = std::string{ "--" } + _name;
|
|
itr->set_command_line({ _opt_name });
|
|
auto* _arg = static_cast<parser_t::argument*>(itr->add_argument(_parser));
|
|
if(_arg)
|
|
{
|
|
_arg->action([&_data, itr, _name](parser_t& p) {
|
|
using namespace timemory::join;
|
|
auto _value = join(array_config{ " ", "", "" }, p.get<strvec_t>(_name));
|
|
if(_value.empty()) _value = p.get<std::string>(_name);
|
|
if(_value.empty()) _value = join("", std::boolalpha, p.get<bool>(_name));
|
|
if(_value.empty())
|
|
throw exception<std::runtime_error>("Error! no value for " + _name);
|
|
update_env(_data, itr->get_env_name(), _value);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
TIMEMORY_PRINTF_WARNING(stderr, "Warning! Option %s (%s) is not enabled\n",
|
|
_name.c_str(), itr->get_env_name().c_str());
|
|
_parser.add_argument({ _opt_name }, itr->get_description())
|
|
.action([&](parser_t& p) {
|
|
using namespace timemory::join;
|
|
auto _value =
|
|
join(array_config{ " ", "", "" }, p.get<strvec_t>(_name));
|
|
if(_value.empty())
|
|
throw exception<std::runtime_error>("Error! no value for " +
|
|
_name);
|
|
update_env(_data, itr->get_env_name(), _value);
|
|
});
|
|
}
|
|
return true;
|
|
};
|
|
|
|
auto _settings = std::vector<std::shared_ptr<tim::vsettings>>{};
|
|
for(auto& itr : *omnitrace::settings::instance())
|
|
{
|
|
if(itr.second->get_categories().count("omnitrace") == 0) continue;
|
|
if(itr.second->get_categories().count("deprecated") > 0) continue;
|
|
if(itr.second->get_hidden()) continue;
|
|
if(!_data.setting_filter(itr.second.get(), _data)) continue;
|
|
if(!_data.environ_filter(itr.second->get_name(), _data)) continue;
|
|
if(itr.second->get_categories().count(_group_name) == 0) continue;
|
|
|
|
itr.second->set_enabled(true);
|
|
_settings.emplace_back(itr.second);
|
|
|
|
if(itr.second->get_name() == "papi_events")
|
|
{
|
|
auto _choices = itr.second->get_choices();
|
|
_choices.erase(
|
|
std::remove_if(_choices.begin(), _choices.end(),
|
|
[](const auto& citr) {
|
|
return std::regex_search(
|
|
citr,
|
|
std::regex{ "[A-Za-z0-9]:([A-Za-z_]+)" }) ||
|
|
std::regex_search(citr, std::regex{ "io:::" });
|
|
}),
|
|
_choices.end());
|
|
_choices.emplace_back(
|
|
"... run `omnitrace-avail -H -c CPU` for full list ...");
|
|
itr.second->set_choices(_choices);
|
|
}
|
|
}
|
|
|
|
std::sort(_settings.begin(), _settings.end(), [](const auto& _lhs, const auto& _rhs) {
|
|
auto _lhs_v = _lhs->get_name();
|
|
auto _rhs_v = _rhs->get_name();
|
|
if(_lhs_v.length() > 4 && _rhs_v.length() > 4 &&
|
|
_lhs_v.substr(0, 4) == _rhs_v.substr(0, 4))
|
|
return _lhs_v < _rhs_v;
|
|
return _lhs_v.length() < _rhs_v.length();
|
|
});
|
|
|
|
if(_add_group)
|
|
{
|
|
auto _group_label = _group_name;
|
|
for(auto& c : _group_label)
|
|
c = toupper(c);
|
|
_parser.start_group(_group_label);
|
|
}
|
|
|
|
for(const auto& itr : _settings)
|
|
{
|
|
_add_option(_get_name(itr), itr);
|
|
}
|
|
|
|
if(_add_group) _parser.end_group();
|
|
|
|
return _data;
|
|
}
|
|
|
|
parser_data&
|
|
add_extended_arguments(parser_t& _parser, parser_data& _data)
|
|
{
|
|
auto _category_count_map = std::unordered_map<std::string, uint32_t>{};
|
|
auto _settings = std::vector<std::shared_ptr<tim::vsettings>>{};
|
|
for(auto& itr : *omnitrace::settings::instance())
|
|
{
|
|
if(itr.second->get_categories().count("omnitrace") == 0) continue;
|
|
if(itr.second->get_categories().count("deprecated") > 0) continue;
|
|
if(itr.second->get_hidden()) continue;
|
|
if(!_data.setting_filter(itr.second.get(), _data)) continue;
|
|
if(!_data.environ_filter(itr.second->get_name(), _data)) continue;
|
|
|
|
itr.second->set_enabled(true);
|
|
_settings.emplace_back(itr.second);
|
|
|
|
if(itr.second->get_name() == "papi_events")
|
|
{
|
|
auto _choices = itr.second->get_choices();
|
|
_choices.erase(
|
|
std::remove_if(_choices.begin(), _choices.end(),
|
|
[](const auto& citr) {
|
|
return std::regex_search(
|
|
citr,
|
|
std::regex{ "[A-Za-z0-9]:([A-Za-z_]+)" }) ||
|
|
std::regex_search(citr, std::regex{ "io:::" });
|
|
}),
|
|
_choices.end());
|
|
_choices.emplace_back(
|
|
"... run `omnitrace-avail -H -c CPU` for full list ...");
|
|
itr.second->set_choices(_choices);
|
|
}
|
|
|
|
for(const auto& citr : itr.second->get_categories())
|
|
{
|
|
if(std::regex_search(
|
|
citr, std::regex{
|
|
"omnitrace|timemory|^(native|custom|advanced|analysis)$" }))
|
|
continue;
|
|
_category_count_map[citr] += 1;
|
|
}
|
|
}
|
|
|
|
auto _category_count_vec = strvec_t{};
|
|
for(const auto& itr : _category_count_map)
|
|
_category_count_vec.emplace_back(itr.first);
|
|
|
|
std::sort(_category_count_vec.begin(), _category_count_vec.end(),
|
|
[&_category_count_map](const auto& _lhs, const auto& _rhs) {
|
|
auto _lhs_v = _category_count_map.at(_lhs);
|
|
auto _rhs_v = _category_count_map.at(_rhs);
|
|
if(_lhs_v == _rhs_v) return _lhs < _rhs;
|
|
return _lhs_v > _rhs_v;
|
|
});
|
|
|
|
auto _groups =
|
|
std::unordered_map<std::string, std::vector<std::shared_ptr<tim::vsettings>>>{};
|
|
for(const auto& citr : _category_count_vec)
|
|
{
|
|
_groups[citr] = {};
|
|
for(const auto& itr : _settings)
|
|
{
|
|
if(itr->get_categories().count(citr) > 0) _groups[citr].emplace_back(itr);
|
|
}
|
|
_settings.erase(std::remove_if(_settings.begin(), _settings.end(),
|
|
[&citr](const auto& itr) {
|
|
return itr->get_categories().count(citr) > 0;
|
|
}),
|
|
_settings.end());
|
|
}
|
|
|
|
for(const auto& citr : _category_count_vec)
|
|
{
|
|
auto _group = _groups.at(citr);
|
|
if(_group.empty()) continue;
|
|
|
|
add_group_arguments(_parser, citr, _data, true);
|
|
}
|
|
|
|
return _data;
|
|
}
|
|
} // namespace argparse
|
|
} // namespace omnitrace
|