Rename hosttrace to omnitrace (#18)

Šī revīzija ir iekļauta:
Jonathan R. Madsen
2021-11-24 04:59:59 -06:00
revīziju iesūtīja GitHub
vecāks 752424efc2
revīzija 39cf760a4e
46 mainīti faili ar 906 papildinājumiem un 830 dzēšanām
+83 -83
Parādīt failu
@@ -55,7 +55,7 @@ get_config()
(void) _once;
}
#define HOSTTRACE_CONFIG_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE) \
#define OMNITRACE_CONFIG_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE) \
_config->insert<TYPE, TYPE>(ENV_NAME, ENV_NAME, DESCRIPTION, INITIAL_VALUE, \
std::vector<std::string>{})
} // namespace
@@ -72,112 +72,112 @@ configure_settings()
// if using timemory, default to perfetto being off
auto _default_perfetto_v =
!tim::get_env<bool>("HOSTTRACE_USE_TIMEMORY", false, false);
!tim::get_env<bool>("OMNITRACE_USE_TIMEMORY", false, false);
auto _default_config_file =
JOIN("/", tim::get_env<std::string>("HOME", "."), "hosttrace.cfg");
JOIN("/", tim::get_env<std::string>("HOME", "."), "omnitrace.cfg");
auto _system_backend = tim::get_env("HOSTTRACE_BACKEND_SYSTEM", false, false);
auto _system_backend = tim::get_env("OMNITRACE_BACKEND_SYSTEM", false, false);
HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_CONFIG_FILE",
"Configuration file of hosttrace and timemory settings",
OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_CONFIG_FILE",
"Configuration file of omnitrace and timemory settings",
_default_config_file);
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_DEBUG", "Enable debugging output",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_DEBUG", "Enable debugging output",
_config->get_debug());
auto _hosttrace_debug = _config->get<bool>("HOSTTRACE_DEBUG");
if(_hosttrace_debug) tim::set_env("TIMEMORY_DEBUG_SETTINGS", "1", 0);
auto _omnitrace_debug = _config->get<bool>("OMNITRACE_DEBUG");
if(_omnitrace_debug) tim::set_env("TIMEMORY_DEBUG_SETTINGS", "1", 0);
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_USE_PERFETTO", "Enable perfetto backend",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_PERFETTO", "Enable perfetto backend",
_default_perfetto_v);
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_USE_TIMEMORY", "Enable timemory backend",
!_config->get<bool>("HOSTTRACE_USE_PERFETTO"));
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_TIMEMORY", "Enable timemory backend",
!_config->get<bool>("OMNITRACE_USE_PERFETTO"));
HOSTTRACE_CONFIG_SETTING(
bool, "HOSTTRACE_USE_PID",
OMNITRACE_CONFIG_SETTING(
bool, "OMNITRACE_USE_PID",
"Enable tagging filenames with process identifier (either MPI rank or pid)",
true);
HOSTTRACE_CONFIG_SETTING(
size_t, "HOSTTRACE_SAMPLE_RATE",
OMNITRACE_CONFIG_SETTING(
size_t, "OMNITRACE_SAMPLE_RATE",
"Counts every function call (N), only record function if (N % <VALUE> == 0)", 1);
auto _backend = tim::get_env_choice<std::string>(
"HOSTTRACE_BACKEND",
"OMNITRACE_BACKEND",
(_system_backend)
? "system" // if HOSTTRACE_BACKEND_SYSTEM is true, default to system.
? "system" // if OMNITRACE_BACKEND_SYSTEM is true, default to system.
: "inprocess", // Otherwise, default to inprocess
{ "inprocess", "system", "all" }, false);
HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_BACKEND",
OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_BACKEND",
"Specify the perfetto backend to activate. Options are: "
"'inprocess', 'system', or 'all'",
_backend);
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_CRITICAL_TRACE",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_CRITICAL_TRACE",
"Enable generation of the critical trace", false);
HOSTTRACE_CONFIG_SETTING(
bool, "HOSTTRACE_ROCTRACER_TIMELINE_PROFILE",
OMNITRACE_CONFIG_SETTING(
bool, "OMNITRACE_ROCTRACER_TIMELINE_PROFILE",
"Create unique entries for every kernel with timemory backend",
_config->get_timeline_profile());
HOSTTRACE_CONFIG_SETTING(
bool, "HOSTTRACE_ROCTRACER_FLAT_PROFILE",
OMNITRACE_CONFIG_SETTING(
bool, "OMNITRACE_ROCTRACER_FLAT_PROFILE",
"Ignore hierarchy in all kernels entries with timemory backend",
_config->get_flat_profile());
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_ROCTRACER_HSA_ACTIVITY",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_ROCTRACER_HSA_ACTIVITY",
"Enable HSA activity tracing support", false);
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_ROCTRACER_HSA_API",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_ROCTRACER_HSA_API",
"Enable HSA API tracing support", false);
HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_ROCTRACER_HSA_API_TYPES",
OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_ROCTRACER_HSA_API_TYPES",
"HSA API type to collect", "");
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_CRITICAL_TRACE_DEBUG",
"Enable debugging for critical trace", _hosttrace_debug);
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_CRITICAL_TRACE_DEBUG",
"Enable debugging for critical trace", _omnitrace_debug);
HOSTTRACE_CONFIG_SETTING(
bool, "HOSTTRACE_CRITICAL_TRACE_SERIALIZE_NAMES",
OMNITRACE_CONFIG_SETTING(
bool, "OMNITRACE_CRITICAL_TRACE_SERIALIZE_NAMES",
"Include names in serialization of critical trace (mainly for debugging)",
_hosttrace_debug);
_omnitrace_debug);
HOSTTRACE_CONFIG_SETTING(size_t, "HOSTTRACE_SHMEM_SIZE_HINT_KB",
OMNITRACE_CONFIG_SETTING(size_t, "OMNITRACE_SHMEM_SIZE_HINT_KB",
"Hint for shared-memory buffer size in perfetto (in KB)",
40960);
HOSTTRACE_CONFIG_SETTING(size_t, "HOSTTRACE_BUFFER_SIZE_KB",
OMNITRACE_CONFIG_SETTING(size_t, "OMNITRACE_BUFFER_SIZE_KB",
"Size of perfetto buffer (in KB)", 1024000);
HOSTTRACE_CONFIG_SETTING(int64_t, "HOSTTRACE_CRITICAL_TRACE_COUNT",
OMNITRACE_CONFIG_SETTING(int64_t, "OMNITRACE_CRITICAL_TRACE_COUNT",
"Number of critical trace to export (0 == all)", 0);
HOSTTRACE_CONFIG_SETTING(uint64_t, "HOSTTRACE_CRITICAL_TRACE_BUFFER_COUNT",
OMNITRACE_CONFIG_SETTING(uint64_t, "OMNITRACE_CRITICAL_TRACE_BUFFER_COUNT",
"Number of critical trace records to store in thread-local "
"memory before submitting to shared buffer",
2000);
HOSTTRACE_CONFIG_SETTING(
uint64_t, "HOSTTRACE_CRITICAL_TRACE_NUM_THREADS",
OMNITRACE_CONFIG_SETTING(
uint64_t, "OMNITRACE_CRITICAL_TRACE_NUM_THREADS",
"Number of threads to use when generating the critical trace",
std::min<uint64_t>(8, std::thread::hardware_concurrency()));
HOSTTRACE_CONFIG_SETTING(
int64_t, "HOSTTRACE_CRITICAL_TRACE_PER_ROW",
OMNITRACE_CONFIG_SETTING(
int64_t, "OMNITRACE_CRITICAL_TRACE_PER_ROW",
"How many critical traces per row in perfetto (0 == all in one row)", 0);
HOSTTRACE_CONFIG_SETTING(
std::string, "HOSTTRACE_COMPONENTS",
OMNITRACE_CONFIG_SETTING(
std::string, "OMNITRACE_COMPONENTS",
"List of components to collect via timemory (see timemory-avail)", "wall_clock");
HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_OUTPUT_FILE", "Perfetto filename",
OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_OUTPUT_FILE", "Perfetto filename",
"");
HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_SETTINGS_DESC",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_SETTINGS_DESC",
"Provide descriptions when printing settings", false);
_config->get_flamegraph_output() = false;
@@ -193,13 +193,13 @@ configure_settings()
_config->get_timing_precision() = 6;
for(auto&& itr :
tim::delimit(_config->get<std::string>("HOSTTRACE_CONFIG_FILE"), ";:"))
tim::delimit(_config->get<std::string>("OMNITRACE_CONFIG_FILE"), ";:"))
{
HOSTTRACE_CONDITIONAL_BASIC_PRINT(true, "Reading config file %s\n", itr.c_str());
OMNITRACE_CONDITIONAL_BASIC_PRINT(true, "Reading config file %s\n", itr.c_str());
_config->read(itr);
}
_config->get_global_components() = _config->get<std::string>("HOSTTRACE_COMPONENTS");
_config->get_global_components() = _config->get<std::string>("OMNITRACE_COMPONENTS");
// always initialize timemory because gotcha wrappers are always used
auto _cmd = tim::read_command_line(process::get_id());
@@ -220,11 +220,11 @@ configure_settings()
using argparser_t = tim::argparse::argument_parser;
argparser_t _parser{ _exe };
tim::timemory_init(_cmd, _parser, "hosttrace-");
tim::timemory_init(_cmd, _parser, "omnitrace-");
settings::suppress_parsing() = true;
settings::suppress_config() = true;
settings::use_output_suffix() = _config->get<bool>("HOSTTRACE_USE_PID");
settings::use_output_suffix() = _config->get<bool>("OMNITRACE_USE_PID");
}
void
@@ -253,12 +253,12 @@ print_config_settings(std::ostream& _os,
std::sort(_data.begin(), _data.end(), [](const auto& lhs, const auto& rhs) {
auto _npos = std::string::npos;
// HOSTTRACE_CONFIG_FILE always first
if(lhs.at(0).find("HOSTTRACE_CONFIG") != _npos) return true;
if(rhs.at(0).find("HOSTTRACE_CONFIG") != _npos) return false;
// HOSTTRACE_USE_* prioritized
auto _lhs_use = lhs.at(0).find("HOSTTRACE_USE_");
auto _rhs_use = rhs.at(0).find("HOSTTRACE_USE_");
// OMNITRACE_CONFIG_FILE always first
if(lhs.at(0).find("OMNITRACE_CONFIG") != _npos) return true;
if(rhs.at(0).find("OMNITRACE_CONFIG") != _npos) return false;
// OMNITRACE_USE_* prioritized
auto _lhs_use = lhs.at(0).find("OMNITRACE_USE_");
auto _rhs_use = rhs.at(0).find("OMNITRACE_USE_");
if(_lhs_use != _rhs_use && _lhs_use < _rhs_use) return true;
if(_lhs_use != _rhs_use && _lhs_use > _rhs_use) return false;
// length sort followed by alphabetical sort
@@ -267,7 +267,7 @@ print_config_settings(std::ostream& _os,
: (lhs.at(0).length() < rhs.at(0).length());
});
bool _print_desc = get_debug() || get_config()->get<bool>("HOSTTRACE_SETTINGS_DESC");
bool _print_desc = get_debug() || get_config()->get<bool>("OMNITRACE_SETTINGS_DESC");
auto tot_width = std::accumulate(_widths.begin(), _widths.end(), 0);
if(!_print_desc) tot_width -= _widths.back() + 4;
@@ -277,7 +277,7 @@ print_config_settings(std::ostream& _os,
_spacer << "#" << std::setw(tot_width + 11) << ""
<< "#";
_os << _spacer.str() << "\n";
// _os << "# Hosttrace settings:" << std::setw(tot_width - 8) << "#" << "\n";
// _os << "# Omnitrace settings:" << std::setw(tot_width - 8) << "#" << "\n";
for(const auto& itr : _data)
{
_os << "# ";
@@ -315,112 +315,112 @@ get_exe_name()
std::string
get_config_file()
{
static auto _v = get_config()->find("HOSTTRACE_CONFIG_FILE");
static auto _v = get_config()->find("OMNITRACE_CONFIG_FILE");
return static_cast<tim::tsettings<std::string>&>(*_v->second).get();
}
bool
get_debug()
{
static auto _v = get_config()->find("HOSTTRACE_DEBUG");
static auto _v = get_config()->find("OMNITRACE_DEBUG");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_use_perfetto()
{
static auto _v = get_config()->find("HOSTTRACE_USE_PERFETTO");
static auto _v = get_config()->find("OMNITRACE_USE_PERFETTO");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_use_timemory()
{
static auto _v = get_config()->find("HOSTTRACE_USE_TIMEMORY");
static auto _v = get_config()->find("OMNITRACE_USE_TIMEMORY");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool&
get_use_pid()
{
static auto _v = get_config()->find("HOSTTRACE_USE_PID");
static auto _v = get_config()->find("OMNITRACE_USE_PID");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_use_mpip()
{
static bool _v = tim::get_env("HOSTTRACE_USE_MPIP", false, false);
static bool _v = tim::get_env("OMNITRACE_USE_MPIP", false, false);
return _v;
}
bool
get_use_critical_trace()
{
static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE");
static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_critical_trace_debug()
{
static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_DEBUG");
static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_DEBUG");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_critical_trace_serialize_names()
{
static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_SERIALIZE_NAMES");
static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_SERIALIZE_NAMES");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_roctracer_timeline_profile()
{
static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_TIMELINE_PROFILE");
static auto _v = get_config()->find("OMNITRACE_ROCTRACER_TIMELINE_PROFILE");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_roctracer_flat_profile()
{
static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_FLAT_PROFILE");
static auto _v = get_config()->find("OMNITRACE_ROCTRACER_FLAT_PROFILE");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_trace_hsa_api()
{
static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_HSA_API");
static auto _v = get_config()->find("OMNITRACE_ROCTRACER_HSA_API");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool
get_trace_hsa_activity()
{
static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_HSA_ACTIVITY");
static auto _v = get_config()->find("OMNITRACE_ROCTRACER_HSA_ACTIVITY");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
int64_t
get_critical_trace_per_row()
{
static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_PER_ROW");
static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_PER_ROW");
return static_cast<tim::tsettings<int64_t>&>(*_v->second).get();
}
size_t
get_perfetto_shmem_size_hint()
{
static auto _v = get_config()->find("HOSTTRACE_SHMEM_SIZE_HINT_KB");
static auto _v = get_config()->find("OMNITRACE_SHMEM_SIZE_HINT_KB");
return static_cast<tim::tsettings<size_t>&>(*_v->second).get();
}
size_t
get_perfetto_buffer_size()
{
static auto _v = get_config()->find("HOSTTRACE_BUFFER_SIZE_KB");
static auto _v = get_config()->find("OMNITRACE_BUFFER_SIZE_KB");
return static_cast<tim::tsettings<size_t>&>(*_v->second).get();
}
@@ -428,7 +428,7 @@ uint64_t
get_critical_trace_update_freq()
{
static uint64_t _v =
get_config()->get<uint64_t>("HOSTTRACE_CRITICAL_TRACE_BUFFER_COUNT");
get_config()->get<uint64_t>("OMNITRACE_CRITICAL_TRACE_BUFFER_COUNT");
return _v;
}
@@ -436,7 +436,7 @@ uint64_t
get_critical_trace_num_threads()
{
static uint64_t _v =
get_config()->get<uint64_t>("HOSTTRACE_CRITICAL_TRACE_NUM_THREADS");
get_config()->get<uint64_t>("OMNITRACE_CRITICAL_TRACE_NUM_THREADS");
return _v;
}
@@ -444,7 +444,7 @@ std::string
get_trace_hsa_api_types()
{
static std::string _v =
get_config()->get<std::string>("HOSTTRACE_ROCTRACER_HSA_API_TYPES");
get_config()->get<std::string>("OMNITRACE_ROCTRACER_HSA_API_TYPES");
return _v;
}
@@ -452,14 +452,14 @@ std::string&
get_backend()
{
// select inprocess, system, or both (i.e. all)
static auto _v = get_config()->find("HOSTTRACE_BACKEND");
static auto _v = get_config()->find("OMNITRACE_BACKEND");
return static_cast<tim::tsettings<std::string>&>(*_v->second).get();
}
std::string
get_perfetto_output_filename()
{
static auto _v = get_config()->find("HOSTTRACE_OUTPUT_FILE");
static auto _v = get_config()->find("OMNITRACE_OUTPUT_FILE");
static auto& _t = static_cast<tim::tsettings<std::string>&>(*_v->second);
if(_t.get().empty())
{
@@ -475,7 +475,7 @@ get_perfetto_output_filename()
_default_fname.replace(_dpos, _pid_patch.length(), "/perfetto-trace");
// have the default display the full path to the output file
_t.set(tim::get_env<std::string>(
"HOSTTRACE_OUTPUT_FILE",
"OMNITRACE_OUTPUT_FILE",
JOIN('/', tim::get_env<std::string>("PWD", ".", false), _default_fname),
false));
}
@@ -485,14 +485,14 @@ get_perfetto_output_filename()
size_t&
get_sample_rate()
{
static auto _v = get_config()->find("HOSTTRACE_SAMPLE_RATE");
static auto _v = get_config()->find("OMNITRACE_SAMPLE_RATE");
return static_cast<tim::tsettings<size_t>&>(*_v->second).get();
}
int64_t
get_critical_trace_count()
{
static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_COUNT");
static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_COUNT");
return static_cast<tim::tsettings<int64_t>&>(*_v->second).get();
}
@@ -513,10 +513,10 @@ get_cpu_cid()
std::unique_ptr<std::vector<uint64_t>>&
get_cpu_cid_stack(int64_t _tid)
{
struct hosttrace_cpu_cid_stack
struct omnitrace_cpu_cid_stack
{};
using thread_data_t =
hosttrace_thread_data<std::vector<uint64_t>, hosttrace_cpu_cid_stack>;
omnitrace_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)