omnitrace-dl-library (#25)
* timemory submodule update
* Visibility, setting categories, and task-group protection
- OMNITRACE_VISIBILITY instead of TIMEMORY_VISIBILITY
- increased task group data-race protection
- add omnitrace categories to settings
* set component_apis type-trait
* omnitrace-dl-library implementation
- this library dlopen + dlsym's libomnitrace
- significantly reduces the instrumentation time
* omnitrace-avail categories
- suppress AVAILABLE column when --available
* omnitrace-exe update
- uses omnitrace-dl
- adds --print-excluded option
- removes --jump option
- comments out --stubs option
- removes --stdlib option
- support for C++ STL functions not in libstdc++
- tweak the --print-* outputs
- significantly refactors instrument_module and instrument_entity
- removes unused c_stdlib_module_constraint
- removes unused c_stdlib_function_constraint
- decreases get_whole_function_names() coverage
* library.cpp updates
- OMNITRACE_DEBUG -> OMNITRACE_DEBUG_F
- omnitrace_finalize sets state earlier
- omnitrace_finalize clears push/pop functors
- increased tasking shutdown safety
* - fix critical-trace thread hierarchy
- signal handler calls omnitrace_finalize
- get_cpu_cid_stack supports parent tid
- interval data reserves
- omnitrace-avail serialization support for module_functions
- omnitrace --simulate option
- omnitrace --print-format option
- omnitrace --load-instr option
- omnitrace runtime-inst doesn't oneTimeCode
- updated regex
- expand get_whole_function_names()
- Test Install CI update
* fixes to last commit
- expand get_whole_function_names()
- ignore sig c modules
- kill process in signal handler
* Remove RTLD_DEEPBIND + more
- removed use of RTLD_DEEPBIND
- causes dyninst segfaults
- fixed signal handling
- updated timemory submodule
* Build/link static timemory libraries
* omnitrace --{module,function}-restrict option
- Added restrict regex options
- Reworked handling of regex options
- Reworked reporting of module/function skipping
- Handle -o w/o file specified
* timemory-avail
- category views
- backtrace::sample checks state
* get_debug_sampling()
This commit is contained in:
committed by
GitHub
parent
b016c8929f
commit
145a6ae06f
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "library/config.hpp"
|
||||
#include "library/api.hpp"
|
||||
#include "library/debug.hpp"
|
||||
#include "library/defines.hpp"
|
||||
#include "library/thread_data.hpp"
|
||||
@@ -29,16 +30,21 @@
|
||||
#include <timemory/backends/mpi.hpp>
|
||||
#include <timemory/backends/process.hpp>
|
||||
#include <timemory/environment.hpp>
|
||||
#include <timemory/sampling/allocator.hpp>
|
||||
#include <timemory/settings.hpp>
|
||||
#include <timemory/settings/types.hpp>
|
||||
#include <timemory/utility/argparse.hpp>
|
||||
#include <timemory/utility/declaration.hpp>
|
||||
#include <timemory/utility/signals.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <csignal>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <numeric>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace omnitrace
|
||||
{
|
||||
@@ -69,7 +75,8 @@ get_setting_name(std::string _v)
|
||||
{ \
|
||||
auto _ret = _config->insert<TYPE, TYPE>( \
|
||||
ENV_NAME, get_setting_name(ENV_NAME), DESCRIPTION, INITIAL_VALUE, \
|
||||
std::set<std::string>{ "custom", "omnitrace", __VA_ARGS__ }); \
|
||||
std::set<std::string>{ "custom", "omnitrace", "omnitrace-library", \
|
||||
__VA_ARGS__ }); \
|
||||
if(!_ret.second) \
|
||||
OMNITRACE_PRINT("Warning! Duplicate setting: %s / %s\n", \
|
||||
get_setting_name(ENV_NAME).c_str(), ENV_NAME); \
|
||||
@@ -261,6 +268,24 @@ configure_settings()
|
||||
_config->get_memory_units() = "MB";
|
||||
_config->get_papi_events() = "PAPI_TOT_CYC, PAPI_TOT_INS";
|
||||
|
||||
// settings native to timemory but critically and/or extensively used by omnitrace
|
||||
auto _add_omnitrace_category = [](auto itr) {
|
||||
if(itr != _config->end())
|
||||
{
|
||||
auto _categories = itr->second->get_categories();
|
||||
_categories.emplace("omnitrace");
|
||||
_categories.emplace("omnitrace-library");
|
||||
itr->second->set_categories(_categories);
|
||||
}
|
||||
};
|
||||
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_CONFIG_FILE"));
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_DEBUG"));
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_VERBOSE"));
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_TIME_OUTPUT"));
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_OUTPUT_PREFIX"));
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_OUTPUT_PATH"));
|
||||
|
||||
#if defined(TIMEMORY_USE_PAPI)
|
||||
int _paranoid = 2;
|
||||
{
|
||||
@@ -287,6 +312,10 @@ configure_settings()
|
||||
tim::trait::runtime_enabled<comp::cpu_roofline_sp_flops>::set(false);
|
||||
_config->get_papi_events() = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
_add_omnitrace_category(_config->find("OMNITRACE_PAPI_EVENTS"));
|
||||
}
|
||||
#else
|
||||
_config->get_papi_quiet() = true;
|
||||
#endif
|
||||
@@ -330,6 +359,30 @@ configure_settings()
|
||||
if(tim::mpi::is_initialized()) settings::default_process_suffix() = tim::mpi::rank();
|
||||
#endif
|
||||
OMNITRACE_CONDITIONAL_BASIC_PRINT(get_verbose_env() > 0, "configuration complete\n");
|
||||
|
||||
if(_config->get_enable_signal_handler())
|
||||
{
|
||||
using signal_settings = tim::signal_settings;
|
||||
using sys_signal = tim::sys_signal;
|
||||
tim::disable_signal_detection();
|
||||
auto _exit_action = [](int nsig) {
|
||||
tim::sampling::block_signals({ SIGPROF, SIGALRM },
|
||||
tim::sampling::sigmask_scope::process);
|
||||
OMNITRACE_BASIC_PRINT(
|
||||
"Finalizing afer signal %i :: %s\n", nsig,
|
||||
signal_settings::str(static_cast<sys_signal>(nsig)).c_str());
|
||||
if(get_state() == State::Active) omnitrace_finalize();
|
||||
kill(process::get_id(), nsig);
|
||||
};
|
||||
signal_settings::set_exit_action(_exit_action);
|
||||
tim::set_env("SIGNAL_ENABLE_INTERRUPT", "1", 0);
|
||||
signal_settings::check_environment();
|
||||
auto default_signals = signal_settings::get_default();
|
||||
for(const auto& itr : default_signals)
|
||||
signal_settings::enable(itr);
|
||||
auto enabled_signals = signal_settings::get_enabled();
|
||||
tim::enable_signal_detection(enabled_signals);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -575,6 +628,13 @@ get_debug()
|
||||
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
|
||||
}
|
||||
|
||||
bool
|
||||
get_debug_sampling()
|
||||
{
|
||||
static bool _v = tim::get_env<bool>("OMNITRACE_DEBUG_SAMPLING", get_debug_env());
|
||||
return (_v || get_debug());
|
||||
}
|
||||
|
||||
int
|
||||
get_verbose_env()
|
||||
{
|
||||
@@ -896,19 +956,24 @@ get_cpu_cid()
|
||||
}
|
||||
|
||||
std::unique_ptr<std::vector<uint64_t>>&
|
||||
get_cpu_cid_stack(int64_t _tid)
|
||||
get_cpu_cid_stack(int64_t _tid, int64_t _parent)
|
||||
{
|
||||
struct omnitrace_cpu_cid_stack
|
||||
{};
|
||||
using thread_data_t = thread_data<std::vector<uint64_t>, omnitrace_cpu_cid_stack>;
|
||||
static auto& _v = thread_data_t::instances();
|
||||
static thread_local auto _v_check = [_tid]() {
|
||||
thread_data_t::construct((_tid > 0) ? *thread_data_t::instances().at(0)
|
||||
: std::vector<uint64_t>{});
|
||||
static auto& _v = thread_data_t::instances();
|
||||
static thread_local auto _v_copy = [_tid, _parent]() {
|
||||
auto _parent_tid = _parent;
|
||||
// if tid != parent and there is not a valid pointer for the provided parent
|
||||
// thread id set it to zero since that will always be valid
|
||||
if(_tid != _parent_tid && !_v.at(_parent_tid)) _parent_tid = 0;
|
||||
// copy over the thread ids from the parent if tid != parent
|
||||
thread_data_t::construct((_tid != _parent_tid) ? *(_v.at(_parent_tid))
|
||||
: std::vector<uint64_t>{});
|
||||
return true;
|
||||
}();
|
||||
return _v.at(_tid);
|
||||
(void) _v_check;
|
||||
(void) _v_copy;
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
Reference in New Issue
Block a user