[rocprof-sys] Use fmt APIs to construct strings instead of JOIN (#2643)
## Motivation With the introduction of the new logging system base on `spdlog` library, opportunity shows to replace `timemory` dependent JOIN implementation with `fmt` library `format` and `join` APIs, which are shipped as a part of `spdlog` lib ## Technical Details Use `fmt` provided APIs to properly format and package strings.
This commit is contained in:
@@ -49,7 +49,6 @@
|
||||
#include <timemory/unwind/dlinfo.hpp>
|
||||
#include <timemory/unwind/types.hpp>
|
||||
#include <timemory/utility/filepath.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
#include <timemory/utility/procfs/maps.hpp>
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "core/config.hpp"
|
||||
|
||||
#include <spdlog/fmt/fmt.h>
|
||||
|
||||
#if !defined(TIMEMORY_USE_BFD)
|
||||
# error "BFD support not enabled"
|
||||
#endif
|
||||
@@ -119,7 +121,8 @@ symbol::operator()(const std::vector<scope_filter>& _filters) const
|
||||
return (sf::satisfies_filter(_filters, sf::FUNCTION_FILTER,
|
||||
rocprofsys::utility::demangle(func)) &&
|
||||
(sf::satisfies_filter(_filters, sf::SOURCE_FILTER, file) ||
|
||||
sf::satisfies_filter(_filters, sf::SOURCE_FILTER, join(':', file, line))));
|
||||
sf::satisfies_filter(_filters, sf::SOURCE_FILTER,
|
||||
fmt::format("{}:{}", file, line))));
|
||||
}
|
||||
|
||||
symbol&
|
||||
@@ -288,7 +291,7 @@ symbol::get_inline_symbols(const std::vector<scope_filter>& _filters) const
|
||||
rocprofsys::utility::demangle(itr.func)) &&
|
||||
(sf::satisfies_filter(_filters, sf::SOURCE_FILTER, itr.file) ||
|
||||
sf::satisfies_filter(_filters, sf::SOURCE_FILTER,
|
||||
join(':', itr.file, itr.line))))
|
||||
fmt::format("{}:{}", itr.file, itr.line))))
|
||||
{
|
||||
if constexpr(concepts::is_unqualified_same<value_type, symbol>::value)
|
||||
{
|
||||
@@ -325,7 +328,7 @@ symbol::get_debug_line_info(const std::vector<scope_filter>& _filters) const
|
||||
{
|
||||
if(sf::satisfies_filter(_filters, sf::SOURCE_FILTER, itr.file) ||
|
||||
sf::satisfies_filter(_filters, sf::SOURCE_FILTER,
|
||||
join(':', itr.file, itr.line)))
|
||||
fmt::format("{}:{}", itr.file, itr.line)))
|
||||
{
|
||||
if constexpr(concepts::is_unqualified_same<value_type, symbol>::value)
|
||||
{
|
||||
|
||||
@@ -30,21 +30,20 @@
|
||||
|
||||
#include <timemory/settings/types.hpp>
|
||||
#include <timemory/utility/filepath.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace argparse
|
||||
{
|
||||
namespace
|
||||
{
|
||||
namespace filepath = ::tim::filepath;
|
||||
namespace path = rocprofsys::common::path;
|
||||
using array_config_t = ::timemory::join::array_config;
|
||||
namespace filepath = ::tim::filepath;
|
||||
namespace path = rocprofsys::common::path;
|
||||
using rocprofsys::common::remove_env;
|
||||
using ::timemory::join::join;
|
||||
|
||||
auto
|
||||
get_clock_id_choices()
|
||||
@@ -305,7 +304,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "ROCPROFSYS_CONFIG_FILE",
|
||||
join(array_config_t{ ":" }, p.get<strvec_t>("config")));
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("config"), ":")));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("config");
|
||||
@@ -501,10 +500,9 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("period-spec(s)")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config_t{ " ", "", "" }, p.get<strvec_t>("periods")),
|
||||
update_mode::WEAK);
|
||||
update_env(_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("periods"), " ")),
|
||||
update_mode::WEAK);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("periods");
|
||||
@@ -732,9 +730,9 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("period-spec(s)")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config_t{ ",", "", "" },
|
||||
p.get<strvec_t>("trace-periods")));
|
||||
update_env(
|
||||
_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("trace-periods"), ",")));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("trace_periods");
|
||||
@@ -887,7 +885,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.required({ "host" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUS",
|
||||
join(array_config_t{ "," }, p.get<strvec_t>("cpus")));
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("cpus"), ",")));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("cpus");
|
||||
@@ -903,7 +901,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.required({ "device" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_GPUS",
|
||||
join(array_config_t{ "," }, p.get<strvec_t>("gpus")));
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("gpus"), ",")));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("gpus");
|
||||
@@ -942,7 +940,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_data, "ROCPROFSYS_SAMPLING_TIDS",
|
||||
join(array_config_t{ ", " }, p.get<std::vector<int64_t>>("tids")));
|
||||
fmt::format("{}",
|
||||
fmt::join(p.get<std::vector<int64_t>>("tids"), ", ")));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("tids");
|
||||
@@ -1013,7 +1012,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
fmt::format("{}", fmt::join(_v, ",")));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1041,7 +1040,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
fmt::format("{}", fmt::join(_v, ",")));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1061,10 +1060,10 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
{
|
||||
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"));
|
||||
throw exception<std::runtime_error>(fmt::format(
|
||||
"'--sample-overflow {} ...' conflicts with "
|
||||
"'--sampling-overflow-event {}' option",
|
||||
_v.front(), p.get<std::string>("sampling-overflow-event")));
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
@@ -1076,7 +1075,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
fmt::format("{}", fmt::join(_v, ",")));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1100,7 +1099,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("[EVENT ...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("cpu-events"));
|
||||
auto _events =
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("cpu-events"), ","));
|
||||
update_env(_data, "ROCPROFSYS_PAPI_EVENTS", _events);
|
||||
});
|
||||
|
||||
@@ -1117,7 +1117,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("[EVENT ...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("gpu-events"));
|
||||
auto _events =
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>("gpu-events"), ","));
|
||||
update_env(_data, "ROCPROFSYS_ROCM_EVENTS", _events);
|
||||
});
|
||||
|
||||
@@ -1196,10 +1197,9 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da
|
||||
if(_arg)
|
||||
{
|
||||
_arg->action([&_data, itr, _name](parser_t& p) {
|
||||
using namespace timemory::join;
|
||||
auto _value = join(array_config{ " ", "", "" }, p.get<strvec_t>(_name));
|
||||
auto _value = fmt::format("{}", fmt::join(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()) _value = fmt::format("{}", 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);
|
||||
@@ -1210,9 +1210,8 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da
|
||||
LOG_WARNING("Option {} ({}) is not enabled", _name, itr->get_env_name());
|
||||
_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));
|
||||
fmt::format("{}", fmt::join(p.get<strvec_t>(_name), " "));
|
||||
if(_value.empty())
|
||||
throw exception<std::runtime_error>("Error! no value for " +
|
||||
_name);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/join.hpp"
|
||||
#include "defines.hpp"
|
||||
#include "rocprofiler-systems/categories.h" // in rocprof-sys-user
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/join.hpp"
|
||||
#include "core/categories.hpp"
|
||||
#include "core/concepts.hpp"
|
||||
#include "core/defines.hpp"
|
||||
@@ -125,8 +124,3 @@ struct construct_on_thread
|
||||
int64_t index = threading::get_id();
|
||||
};
|
||||
} // namespace rocprofsys
|
||||
|
||||
// same sort of functionality as python's " ".join([...])
|
||||
#if !defined(JOIN)
|
||||
# define JOIN(...) ::rocprofsys::common::join(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
@@ -51,12 +51,13 @@
|
||||
#include <timemory/utility/declaration.hpp>
|
||||
#include <timemory/utility/delimit.hpp>
|
||||
#include <timemory/utility/filepath.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
#include <timemory/utility/signals.hpp>
|
||||
#include <timemory/utility/types.hpp>
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
@@ -432,7 +433,7 @@ configure_settings(bool _init)
|
||||
for(const auto& itr : constraint::get_valid_clock_ids())
|
||||
{
|
||||
_clock_choices.emplace_back(
|
||||
join("", "(", join('|', itr.name, itr.value, itr.raw_name), ")"));
|
||||
fmt::format("({}|{}|{})", itr.name, itr.value, itr.raw_name));
|
||||
}
|
||||
|
||||
ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_TRACE_PERIODS",
|
||||
@@ -1558,8 +1559,6 @@ print_banner(std::ostream& _os)
|
||||
std::stringstream _version_info{};
|
||||
_version_info << "rocprof-sys v" << ROCPROFSYS_VERSION_STRING;
|
||||
|
||||
namespace join = ::timemory::join;
|
||||
|
||||
// assemble the list of properties
|
||||
auto _generate_properties =
|
||||
[](std::initializer_list<std::pair<std::string, std::string>>&& _data) {
|
||||
@@ -1570,7 +1569,7 @@ print_banner(std::ostream& _os)
|
||||
if(!itr.second.empty())
|
||||
_property_info.emplace_back(
|
||||
itr.first.empty() ? itr.second
|
||||
: join::join(": ", itr.first, itr.second));
|
||||
: fmt::format("{}: {}", itr.first, itr.second));
|
||||
}
|
||||
return _property_info;
|
||||
};
|
||||
@@ -1584,7 +1583,7 @@ print_banner(std::ostream& _os)
|
||||
|
||||
// <NAME> <VERSION> (<PROPERTIES>)
|
||||
if(!_properties.empty())
|
||||
_version_info << join::join(join::array_config{ ", ", " (", ")" }, _properties);
|
||||
_version_info << fmt::format(" ({})", fmt::join(_properties, ", "));
|
||||
|
||||
_os << _banner << "\n";
|
||||
_os << _version_info.str() << "\n";
|
||||
@@ -2216,8 +2215,8 @@ get_perfetto_output_filename()
|
||||
|
||||
if(!_val.empty() && _val.at(0) != '/')
|
||||
{
|
||||
auto _result =
|
||||
settings::format(JOIN('/', "%env{PWD}%", _val), get_config()->get_tag());
|
||||
auto _result = settings::format(fmt::format("{}/{}", getenv("PWD"), _val),
|
||||
get_config()->get_tag());
|
||||
LOG_DEBUG("Path is relative, prepending PWD: '{}'", _result);
|
||||
return _result;
|
||||
}
|
||||
@@ -2472,7 +2471,8 @@ get_database_absolute_path(std::string_view database_name, std::string_view suff
|
||||
setenv("ROCPROFSYS_DATABASE_DIR", _dir.c_str(), 1);
|
||||
|
||||
if(!_val.empty() && _val.at(0) != '/')
|
||||
return settings::format(JOIN('/', "%env{PWD}%", _val), get_config()->get_tag());
|
||||
return settings::format(fmt::format("{}/{}", getenv("PWD"), _val),
|
||||
get_config()->get_tag());
|
||||
return _val;
|
||||
}
|
||||
|
||||
@@ -2530,8 +2530,8 @@ get_perfetto_output_filename_with_suffix(std::string_view suffix)
|
||||
|
||||
if(!_val.empty() && _val.at(0) != '/')
|
||||
{
|
||||
auto _result =
|
||||
settings::format(JOIN('/', "%env{PWD}%", _val), get_config()->get_tag());
|
||||
auto _result = settings::format(fmt::format("{}/{}", getenv("PWD"), _val),
|
||||
get_config()->get_tag());
|
||||
LOG_DEBUG("Path is relative, prepending PWD: '{}'", _result);
|
||||
return _result;
|
||||
}
|
||||
@@ -2747,7 +2747,7 @@ get_tmp_file(std::string _basename, std::string _ext)
|
||||
_cfg.use_suffix = true;
|
||||
_cfg.suffix = "%pid%";
|
||||
_cfg.explicit_path = get_tmpdir();
|
||||
_cfg.subdirectory = JOIN('/', settings::output_path(), "%ppid%", "");
|
||||
_cfg.subdirectory = fmt::format("{}/{}", settings::output_path(), "%ppid%");
|
||||
auto _fname =
|
||||
settings::compose_output_filename(std::move(_basename), std::move(_ext), _cfg);
|
||||
|
||||
@@ -2782,10 +2782,9 @@ get_causal_backend()
|
||||
} catch(std::runtime_error& _e)
|
||||
{
|
||||
auto _mode = static_cast<tim::tsettings<std::string>&>(*_v->second).get();
|
||||
throw std::runtime_error(fmt::format(
|
||||
"[{}] invalid causal backend {}. Choices: {}", __FUNCTION__, _mode,
|
||||
timemory::join::join(timemory::join::array_config{ ", ", "", "" },
|
||||
_v->second->get_choices())));
|
||||
throw std::runtime_error(
|
||||
fmt::format("[{}] invalid causal backend {}. Choices: {}", __FUNCTION__,
|
||||
_mode, fmt::join(_v->second->get_choices(), ", ")));
|
||||
}
|
||||
return CausalBackend::Auto;
|
||||
}
|
||||
@@ -2813,10 +2812,9 @@ get_causal_mode()
|
||||
} catch(std::runtime_error& _e)
|
||||
{
|
||||
auto _mode = static_cast<tim::tsettings<std::string>&>(*_v->second).get();
|
||||
throw std::runtime_error(fmt::format(
|
||||
"[{}] invalid causal mode {}. Choices: {}", __FUNCTION__, _mode,
|
||||
timemory::join::join(timemory::join::array_config{ ", ", "", "" },
|
||||
_v->second->get_choices())));
|
||||
throw std::runtime_error(
|
||||
fmt::format("[{}] invalid causal mode {}. Choices: {}", __FUNCTION__,
|
||||
_mode, fmt::join(_v->second->get_choices(), ", ")));
|
||||
}
|
||||
return CausalMode::Function;
|
||||
}();
|
||||
@@ -2871,7 +2869,7 @@ format_causal_scopes(std::vector<std::string> _value, const std::string& _tag)
|
||||
{
|
||||
itr = std::regex_replace(
|
||||
itr, _main_re,
|
||||
join("", "$1", "(", get_exe_name(), "|", get_exe_realpath(), ")", "$3"));
|
||||
fmt::format("$1({}|{})$3", get_exe_name(), get_exe_realpath()));
|
||||
}
|
||||
// trim leading and trailing spaces since we didn't delimit spaces
|
||||
if(std::regex_search(itr, _space_re))
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <ratio>
|
||||
@@ -102,10 +104,13 @@ find_clock_identifier(const Tp& _v)
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error(
|
||||
fmt::format("Unknown clock id {}: {}. Valid choices: {}", _descript,
|
||||
timemory::join::join("", _v).c_str(),
|
||||
timemory::join::join("", accepted_clock_ids).c_str()));
|
||||
auto _choices = std::vector<std::string>{};
|
||||
_choices.reserve(accepted_clock_ids.size());
|
||||
for(const auto& itr : accepted_clock_ids)
|
||||
_choices.emplace_back(itr.as_string());
|
||||
|
||||
throw std::runtime_error(fmt::format("Unknown clock id {}: {}. Valid choices: {}",
|
||||
_descript, _v, fmt::join(_choices, "")));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -66,11 +66,11 @@ find_library_path(const std::string& _name, const std::vector<std::string>& _env
|
||||
|
||||
for(auto& itr : _paths)
|
||||
{
|
||||
auto _v = JOIN('/', itr, _name);
|
||||
auto _v = fmt::format("{}/{}", itr, _name);
|
||||
if(filepath::exists(_v)) return _v;
|
||||
for(const auto& litr : _path_suffixes)
|
||||
{
|
||||
_v = JOIN('/', itr, litr, _name);
|
||||
_v = fmt::format("{}/{}/{}", itr, litr, _name);
|
||||
if(filepath::exists(_v)) return _v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ get_concurrent_processes(int _ppid)
|
||||
std::set<int> _children = {};
|
||||
if(_ppid > 0)
|
||||
{
|
||||
auto _inp = JOIN('/', "/proc", _ppid, "task", _ppid, "children");
|
||||
auto _inp = fmt::format("/proc/{}/task/{}/children", _ppid, _ppid);
|
||||
std::ifstream _ifs{ _inp };
|
||||
if(!_ifs)
|
||||
{
|
||||
|
||||
@@ -285,7 +285,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
|
||||
|
||||
if(!_script_dir.empty())
|
||||
{
|
||||
_script_path = rocprofsys::common::join("/", _script_dir, _script_path);
|
||||
_script_path = fmt::format("{}/{}", _script_dir, _script_path);
|
||||
}
|
||||
|
||||
// Test that the script exists
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#if defined(ROCPROFSYS_USE_ROCM) && ROCPROFSYS_USE_ROCM > 0
|
||||
|
||||
# include <timemory/defines.h>
|
||||
@@ -281,11 +283,11 @@ config_settings(const std::shared_ptr<settings>& _config)
|
||||
|
||||
if(_skip_domains.count(_v) > 0) return;
|
||||
|
||||
auto _op_option_name = JOIN('_', "ROCPROFSYS_ROCM", _domain_name, "OPERATIONS");
|
||||
auto _op_option_name = fmt::format("ROCPROFSYS_ROCM_{}_OPERATIONS", _domain_name);
|
||||
auto _eop_option_name =
|
||||
JOIN('_', "ROCPROFSYS_ROCM", _domain_name, "OPERATIONS_EXCLUDE");
|
||||
fmt::format("ROCPROFSYS_ROCM_{}_OPERATIONS_EXCLUDE", _domain_name);
|
||||
auto _bt_option_name =
|
||||
JOIN('_', "ROCPROFSYS_ROCM", _domain_name, "OPERATIONS_ANNOTATE_BACKTRACE");
|
||||
fmt::format("ROCPROFSYS_ROCM_{}_OPERATIONS_ANNOTATE_BACKTRACE", _domain_name);
|
||||
|
||||
auto _op_choices = std::vector<std::string>{};
|
||||
for(auto itr : _domain.operations)
|
||||
@@ -343,10 +345,9 @@ config_settings(const std::shared_ptr<settings>& _config)
|
||||
|
||||
std::sort(_domain_choices.begin(), _domain_choices.end());
|
||||
|
||||
namespace join = ::timemory::join;
|
||||
auto _domain_description =
|
||||
JOIN("", "Specification of ROCm domains to trace/profile. Choices: ",
|
||||
join::join(join::array_config{ ", ", "", "" }, _domain_choices));
|
||||
fmt::format("Specification of ROCm domains to trace/profile. Choices: {}",
|
||||
fmt::join(_domain_choices, ", "));
|
||||
auto _domain_defaults = std::string{ "hip_runtime_api,marker_api,kernel_dispatch,"
|
||||
"memory_copy,scratch_memory" };
|
||||
|
||||
|
||||
+33
-39
@@ -123,7 +123,7 @@ setup_amd_smi_tracks(const uint32_t _device_id, bool is_busy_enabled,
|
||||
if(amd_smi_gfx_track::exists(_device_id)) return;
|
||||
|
||||
auto make_track_name = [&](const char* metric) {
|
||||
return JOIN(" ", "GPU", JOIN("", '[', _device_id, ']'), metric, "(S)");
|
||||
return fmt::format("GPU [{}] {} (S)", _device_id, metric);
|
||||
};
|
||||
|
||||
if(is_busy_enabled)
|
||||
@@ -328,7 +328,7 @@ perfetto_processor_t::start_session()
|
||||
int temp_fd = -1;
|
||||
if(config::get_use_tmp_files())
|
||||
{
|
||||
auto _base = JOIN("-", "cached-perfetto-trace", std::to_string(m_process_id));
|
||||
auto _base = fmt::format("cached-perfetto-trace-{}", m_process_id);
|
||||
m_tmp_file = config::get_tmp_file(_base, "proto");
|
||||
m_tmp_file->open(O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||
temp_fd = m_tmp_file->fd;
|
||||
@@ -484,7 +484,8 @@ perfetto_processor_t::handle([[maybe_unused]] const kernel_dispatch_sample& _kds
|
||||
{
|
||||
#if ROCPROFSYS_USE_ROCM > 0
|
||||
static auto _track_desc = [](uint64_t _device_id_v, uint64_t _queue_id_v) {
|
||||
return JOIN("", "GPU Kernel Dispatch [", _device_id_v, "] Queue ", _queue_id_v);
|
||||
return fmt::format("GPU Kernel Dispatch [{}] Queue {}", _device_id_v,
|
||||
_queue_id_v);
|
||||
};
|
||||
|
||||
auto kernel_symbol = m_metadata.get_kernel_symbol(_kds.kernel_id);
|
||||
@@ -511,24 +512,20 @@ perfetto_processor_t::handle([[maybe_unused]] const kernel_dispatch_sample& _kds
|
||||
if(!m_use_annotations) return;
|
||||
|
||||
annotate_perfetto(
|
||||
ctx,
|
||||
{ { "begin_ns", _beg_ts },
|
||||
{ "end_ns", _end_ts },
|
||||
{ "corr_id", _corr_id },
|
||||
{ "stream_id", _stream_handle },
|
||||
{ "queue", _queue_id_handle },
|
||||
{ "dispatch_id", _kds.dispatch_id },
|
||||
{ "kernel_id", _kds.kernel_id },
|
||||
{ "private_segment_size", _kds.private_segment_size },
|
||||
{ "group_segment_size", _kds.group_segment_size },
|
||||
{ "workgroup_size", JOIN("", "(",
|
||||
JOIN(',', _kds.workgroup_size_x,
|
||||
_kds.workgroup_size_y, _kds.workgroup_size_z),
|
||||
")") },
|
||||
{ "grid_size",
|
||||
JOIN("", "(",
|
||||
JOIN(',', _kds.grid_size_x, _kds.grid_size_y, _kds.grid_size_z),
|
||||
")") } });
|
||||
ctx, { { "begin_ns", _beg_ts },
|
||||
{ "end_ns", _end_ts },
|
||||
{ "corr_id", _corr_id },
|
||||
{ "stream_id", _stream_handle },
|
||||
{ "queue", _queue_id_handle },
|
||||
{ "dispatch_id", _kds.dispatch_id },
|
||||
{ "kernel_id", _kds.kernel_id },
|
||||
{ "private_segment_size", _kds.private_segment_size },
|
||||
{ "group_segment_size", _kds.group_segment_size },
|
||||
{ "workgroup_size",
|
||||
fmt::format("({},{},{})", _kds.workgroup_size_x,
|
||||
_kds.workgroup_size_y, _kds.workgroup_size_z) },
|
||||
{ "grid_size", fmt::format("({},{},{})", _kds.grid_size_x,
|
||||
_kds.grid_size_y, _kds.grid_size_z) } });
|
||||
};
|
||||
|
||||
tracing::push_perfetto(category::rocm_kernel_dispatch{}, kernel_name.c_str(), _track,
|
||||
@@ -566,8 +563,8 @@ perfetto_processor_t::handle([[maybe_unused]] const scratch_memory_sample& _sms)
|
||||
|
||||
if(!counter_track::exists(_agent_device_id))
|
||||
{
|
||||
auto _track_desc_alloc_size = JOIN("", "GPU Scratch Memory [", _agent_device_id,
|
||||
"] Thread ", _thread_id_sequent);
|
||||
auto _track_desc_alloc_size = fmt::format("GPU Scratch Memory [{}] Thread {}",
|
||||
_agent_device_id, _thread_id_sequent);
|
||||
counter_track::emplace(_agent_device_id, _track_desc_alloc_size, "bytes");
|
||||
}
|
||||
|
||||
@@ -579,7 +576,7 @@ perfetto_processor_t::handle([[maybe_unused]] const scratch_memory_sample& _sms)
|
||||
# endif
|
||||
|
||||
auto _track_desc_events = [&]() {
|
||||
return JOIN("", "GPU Scratch Memory Events Thread ", _thread_id_sequent);
|
||||
return fmt::format("GPU Scratch Memory Events Thread {}", _thread_id_sequent);
|
||||
};
|
||||
|
||||
const auto _track =
|
||||
@@ -626,8 +623,8 @@ perfetto_processor_t::handle([[maybe_unused]] const memory_copy_sample& _mcs)
|
||||
|
||||
auto _track_desc = [](int32_t _device_id_v, rocprofiler_thread_id_t _tid) {
|
||||
const auto& _tid_v = thread_info::get(_tid, SystemTID);
|
||||
return JOIN("", "GPU Memory Copy to Agent [", _device_id_v, "] Thread ",
|
||||
_tid_v->index_data->sequent_value);
|
||||
return fmt::format("GPU Memory Copy to Agent [{}] Thread {}", _device_id_v,
|
||||
_tid_v->index_data->sequent_value);
|
||||
};
|
||||
|
||||
const auto _track = tracing::get_perfetto_track(
|
||||
@@ -688,8 +685,8 @@ perfetto_processor_t::handle([[maybe_unused]] const memory_allocate_sample& _mas
|
||||
|
||||
auto _track_desc = [](int32_t _device_id_v, rocprofiler_thread_id_t _tid) {
|
||||
const auto& _tid_v = thread_info::get(_tid, SystemTID);
|
||||
return JOIN("", "GPU Memory Allocation to Agent [", _device_id_v, "] Thread ",
|
||||
_tid_v->index_data->sequent_value);
|
||||
return fmt::format("GPU Memory Allocation to Agent [{}] Thread {}",
|
||||
_device_id_v, _tid_v->index_data->sequent_value);
|
||||
};
|
||||
|
||||
auto _agent_logical_node_id =
|
||||
@@ -1095,16 +1092,14 @@ perfetto_processor_t::handle([[maybe_unused]] const amd_smi_sample& _amd_smi)
|
||||
if(_idx.has_value())
|
||||
{
|
||||
// Per-XCP format
|
||||
track_name = JOIN(
|
||||
" ", "GPU", JOIN("", '[', _device_id, ']'), metric_name,
|
||||
JOIN("", "XCP_", _idx.value(), ": [", (i < 10 ? "0" : ""), i, ']'),
|
||||
"(S)");
|
||||
track_name = fmt::format("GPU [{}] {} XCP_{}: [{:02}] (S)", _device_id,
|
||||
metric_name, _idx.value(), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Device-level format
|
||||
track_name = JOIN(" ", "GPU", JOIN("", '[', _device_id, ']'), metric_name,
|
||||
JOIN("", "[", (i < 10 ? "0" : ""), i, ']'), "(S)");
|
||||
track_name =
|
||||
fmt::format("GPU [{}] {} [{:02}] (S)", _device_id, metric_name, i);
|
||||
}
|
||||
|
||||
auto generate_track_key = [](uint32_t _dev_idx, size_t _xcp_idx,
|
||||
@@ -1149,9 +1144,8 @@ perfetto_processor_t::handle([[maybe_unused]] const amd_smi_sample& _amd_smi)
|
||||
const auto value = data[i];
|
||||
if(value == std::numeric_limits<uint64_t>::max()) continue;
|
||||
|
||||
std::string track_name =
|
||||
JOIN(" ", "GPU", JOIN("", '[', _device_id, ']'),
|
||||
trait::name<Category>::value, JOIN("", "[", i, ']'), "(S)");
|
||||
std::string track_name = fmt::format("GPU [{}] {} [{:02}] (S)", _device_id,
|
||||
trait::name<Category>::value, i);
|
||||
|
||||
auto unique_key = (_device_id << 8) | i;
|
||||
|
||||
@@ -1213,7 +1207,7 @@ perfetto_processor_t::handle([[maybe_unused]] const amd_smi_sample& _amd_smi)
|
||||
if(is_xgmi_enabled)
|
||||
{
|
||||
auto make_track_name = [&](const char* metric) {
|
||||
return JOIN(" ", "GPU", JOIN("", '[', _device_id, ']'), metric, "(S)");
|
||||
return fmt::format("GPU [{}] {} (S)", _device_id, metric);
|
||||
};
|
||||
|
||||
if(!amd_smi_xgmi_link_width_track::exists(_device_id))
|
||||
@@ -1245,7 +1239,7 @@ perfetto_processor_t::handle([[maybe_unused]] const amd_smi_sample& _amd_smi)
|
||||
if(is_pcie_enabled)
|
||||
{
|
||||
auto make_track_name = [&](const char* metric) {
|
||||
return JOIN(" ", "GPU", JOIN("", '[', _device_id, ']'), metric, "(S)");
|
||||
return fmt::format("GPU [{}] {} (S)", _device_id, metric);
|
||||
};
|
||||
|
||||
if(!amd_smi_pcie_link_width_track::exists(_device_id))
|
||||
|
||||
@@ -171,7 +171,7 @@ rocpd_processor_t::handle([[maybe_unused]] const scratch_memory_sample& _sms)
|
||||
|
||||
auto [memory_operation, memory_type] = parse_memory_operation_name(_name);
|
||||
|
||||
auto extdata_json_str = JOIN("", "{\"flags\": ", _sms.flags, "}");
|
||||
auto extdata_json_str = fmt::format("{{\"flags\": {}}}", _sms.flags);
|
||||
|
||||
m_data_processor->insert_memory_alloc(
|
||||
n_info.id, process.pid, thread_primary_key, agent_primary_key,
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <timemory/mpl/concepts.hpp>
|
||||
#include <timemory/utility/delimit.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -216,8 +215,13 @@ get_regex_or(const ContainerT<Tp, TailT...>& _container, const std::string& _fal
|
||||
|
||||
if(_container.empty()) return _fallback;
|
||||
|
||||
namespace join = timemory::join;
|
||||
return join::join(join::array_config{ "|", "(", ")" }, _container);
|
||||
auto _ss = std::stringstream{};
|
||||
auto _idx = size_t{ 0 };
|
||||
_ss << "(";
|
||||
for(const auto& itr : _container)
|
||||
_ss << (_idx++ > 0 ? "|" : "") << itr;
|
||||
_ss << ")";
|
||||
return _ss.str();
|
||||
}
|
||||
|
||||
template <template <typename, typename...> class ContainerT, typename Tp,
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
#include <timemory/signals/types.hpp>
|
||||
#include <timemory/units.hpp>
|
||||
#include <timemory/utility/backtrace.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
#include <timemory/utility/procfs/maps.hpp>
|
||||
|
||||
#if ROCPROFSYS_USE_ROCM > 0
|
||||
@@ -98,6 +97,7 @@
|
||||
#include <cstdlib>
|
||||
#include <mutex>
|
||||
#include <pthread.h>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
#include <unistd.h>
|
||||
@@ -224,11 +224,12 @@ ensure_finalization(bool _static_init = false)
|
||||
{
|
||||
auto _verbose =
|
||||
get_verbose_env() + ((get_debug_env() || get_debug_init()) ? 16 : 0);
|
||||
auto _search_paths = JOIN(':', tim::get_env<std::string>("ROCPROFSYS_PATH", ""),
|
||||
tim::get_env<std::string>("PWD"), ".",
|
||||
tim::get_env<std::string>("LD_LIBRARY_PATH", ""),
|
||||
tim::get_env<std::string>("LIBRARY_PATH", ""),
|
||||
tim::get_env<std::string>("PATH", ""));
|
||||
auto _search_paths = fmt::format("{}:{}:{}:{}:{}",
|
||||
tim::get_env<std::string>("ROCPROFSYS_PATH", ""),
|
||||
tim::get_env<std::string>("PWD"), ".",
|
||||
tim::get_env<std::string>("LD_LIBRARY_PATH", ""),
|
||||
tim::get_env<std::string>("LIBRARY_PATH", ""),
|
||||
tim::get_env<std::string>("PATH", ""));
|
||||
common::setup_environ(_verbose, _search_paths);
|
||||
}
|
||||
|
||||
@@ -266,7 +267,8 @@ struct fini_bundle
|
||||
{
|
||||
std::stringstream _ss;
|
||||
if(_print_prefix && m_label.length() > 0) _ss << m_label << " : ";
|
||||
_ss << timemory::join::join(", ", std::get<Tp>(m_data)...);
|
||||
size_t _idx = 0;
|
||||
((_ss << (_idx++ > 0 ? ", " : "") << std::get<Tp>(m_data)), ...);
|
||||
return _ss.str();
|
||||
}
|
||||
|
||||
@@ -780,7 +782,7 @@ rocprofsys_reset_preload_hidden(void)
|
||||
for(const auto& itr : delimit(_preload_libs, ":"))
|
||||
{
|
||||
if(itr.find("librocprof-sys") != std::string::npos) continue;
|
||||
_modified_preload += common::join("", ":", itr);
|
||||
_modified_preload += fmt::format(":{}", itr);
|
||||
}
|
||||
if(!_modified_preload.empty() && _modified_preload.find(':') == 0)
|
||||
_modified_preload = _modified_preload.substr(1);
|
||||
@@ -990,7 +992,7 @@ rocprofsys_finalize_hidden(void)
|
||||
// report the high-level metrics for the process
|
||||
if(get_main_bundle())
|
||||
{
|
||||
std::string _msg = JOIN("", *get_main_bundle());
|
||||
std::string _msg = get_main_bundle()->as_string();
|
||||
auto _pos = _msg.find(">>> ");
|
||||
if(_pos != std::string::npos) _msg = _msg.substr(_pos + 5);
|
||||
LOG_INFO("{}", _msg);
|
||||
@@ -1010,7 +1012,7 @@ rocprofsys_finalize_hidden(void)
|
||||
if(itr && itr->get<comp::wall_clock>() &&
|
||||
!itr->get<comp::wall_clock>()->get_is_running())
|
||||
{
|
||||
std::string _msg = JOIN("", *itr);
|
||||
std::string _msg = itr->as_string();
|
||||
auto _pos = _msg.find(">>> ");
|
||||
if(_pos != std::string::npos) _msg = _msg.substr(_pos + 5);
|
||||
if(_thr_verbose >= 0)
|
||||
|
||||
@@ -864,22 +864,20 @@ data::post_process(uint32_t _dev_id)
|
||||
if(counter_track::exists(_dev_id)) return;
|
||||
|
||||
auto addendum = [&](const char* _v) {
|
||||
return JOIN(" ", "GPU", _v, JOIN("", '[', _dev_id, ']'), "(S)");
|
||||
return fmt::format("GPU {} [{}] (S)", _v, _dev_id);
|
||||
};
|
||||
|
||||
auto addendum_blk = [&](std::size_t _i, const char* _metric,
|
||||
std::size_t xcp_idx = SIZE_MAX) {
|
||||
if(xcp_idx != SIZE_MAX)
|
||||
{
|
||||
return JOIN(
|
||||
" ", "GPU", JOIN("", '[', _dev_id, ']'), _metric,
|
||||
JOIN("", "XCP_", xcp_idx, ": [", (_i < 10 ? "0" : ""), _i, ']'),
|
||||
"(S)");
|
||||
return fmt::format("GPU [{}] {} XCP_{}: [{}] (S)", _dev_id, _metric,
|
||||
xcp_idx, (_i < 10 ? "0" : ""), _i);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JOIN(" ", "GPU", JOIN("", '[', _dev_id, ']'), _metric,
|
||||
JOIN("", "[", (_i < 10 ? "0" : ""), _i, ']'), "(S)");
|
||||
return fmt::format("GPU [{}] {} [{}] (S)", _dev_id, _metric,
|
||||
(_i < 10 ? "0" : ""), _i);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ compute_eligible_lines_impl()
|
||||
{
|
||||
if(sf::satisfies_filter(_filters, sf::SOURCE_FILTER, ditr.file) ||
|
||||
sf::satisfies_filter(_filters, sf::SOURCE_FILTER,
|
||||
join(':', ditr.file, ditr.line)))
|
||||
fmt::format("{}:{}", ditr.file, ditr.line)))
|
||||
{
|
||||
_scoped.debug_info.emplace_back(ditr);
|
||||
}
|
||||
@@ -364,7 +364,7 @@ compute_eligible_lines_impl()
|
||||
void
|
||||
save_maps_info_impl(std::ostream& _ofs)
|
||||
{
|
||||
auto _maps_file = join("/", "/proc", process::get_id(), "maps");
|
||||
auto _maps_file = fmt::format("/proc/{}/maps", process::get_id());
|
||||
auto _ifs = std::ifstream{ _maps_file };
|
||||
auto _maps = std::stringstream{};
|
||||
if(_ifs)
|
||||
@@ -729,12 +729,14 @@ save_line_info(const settings::compose_filename_config& _cfg, int _verbose)
|
||||
}
|
||||
};
|
||||
|
||||
_write(tim::settings::compose_output_filename(
|
||||
join('-', config::get_causal_output_filename(), "binary"), "txt", _cfg),
|
||||
get_cached_binary_info().first, { true, true, true });
|
||||
_write(tim::settings::compose_output_filename(
|
||||
join('-', config::get_causal_output_filename(), "scoped"), "txt", _cfg),
|
||||
get_cached_binary_info().second, { true, true, false });
|
||||
_write(
|
||||
tim::settings::compose_output_filename(
|
||||
fmt::format("{}-binary", config::get_causal_output_filename()), "txt", _cfg),
|
||||
get_cached_binary_info().first, { true, true, true });
|
||||
_write(
|
||||
tim::settings::compose_output_filename(
|
||||
fmt::format("{}-scoped", config::get_causal_output_filename()), "txt", _cfg),
|
||||
get_cached_binary_info().second, { true, true, false });
|
||||
}
|
||||
|
||||
size_t
|
||||
|
||||
+5
-4
@@ -141,7 +141,7 @@ experiment::sample::serialize(ArchiveT& ar, const unsigned)
|
||||
std::string
|
||||
experiment::sample::get_identifier() const
|
||||
{
|
||||
return (lineno > 0 && !location.empty()) ? join(":", location, lineno)
|
||||
return (lineno > 0 && !location.empty()) ? fmt::format("{}:{}", location, lineno)
|
||||
: rocprofsys::utility::demangle(name);
|
||||
}
|
||||
|
||||
@@ -606,9 +606,10 @@ experiment::save_experiments(std::string _fname_base, const filename_config_t& _
|
||||
auto& _selection = itr.selection;
|
||||
auto& _line_info = _selection.symbol;
|
||||
|
||||
std::string _name = (_selection.symbol_address > 0)
|
||||
? _line_info.func
|
||||
: join(":", _line_info.file, _line_info.line);
|
||||
std::string _name =
|
||||
(_selection.symbol_address > 0)
|
||||
? _line_info.func
|
||||
: fmt::format("{}:{}", _line_info.file, _line_info.line);
|
||||
|
||||
if(_name.empty())
|
||||
{
|
||||
|
||||
+7
-7
@@ -256,7 +256,7 @@ void
|
||||
cache_backtrace_metrics_events(const uint32_t device_id, uint64_t timestamp_ns,
|
||||
Value value, int64_t _tid)
|
||||
{
|
||||
auto _tid_name = JOIN("", '[', _tid, ']');
|
||||
auto _tid_name = fmt::format("[{}]", _tid);
|
||||
|
||||
size_t stack_id = 0;
|
||||
size_t parent_stack_id = 0;
|
||||
@@ -378,22 +378,22 @@ void
|
||||
backtrace_metrics::init_perfetto(int64_t _tid, valid_array_t _valid)
|
||||
{
|
||||
auto _hw_cnt_labels = *get_papi_labels(_tid);
|
||||
auto _tid_name = JOIN("", '[', _tid, ']');
|
||||
auto _tid_name = fmt::format("[{}]", _tid);
|
||||
|
||||
if(!perfetto_counter_track<perfetto_rusage>::exists(_tid))
|
||||
{
|
||||
if(get_valid(category::thread_cpu_time{}, _valid))
|
||||
perfetto_counter_track<perfetto_rusage>::emplace(
|
||||
_tid, JOIN(' ', "Thread CPU time", _tid_name, "(S)"), "sec");
|
||||
_tid, fmt::format("Thread CPU time {} (S)", _tid_name), "sec");
|
||||
if(get_valid(category::thread_peak_memory{}, _valid))
|
||||
perfetto_counter_track<perfetto_rusage>::emplace(
|
||||
_tid, JOIN(' ', "Thread Peak Memory Usage", _tid_name, "(S)"), "MB");
|
||||
_tid, fmt::format("Thread Peak Memory Usage {} (S)", _tid_name), "MB");
|
||||
if(get_valid(category::thread_context_switch{}, _valid))
|
||||
perfetto_counter_track<perfetto_rusage>::emplace(
|
||||
_tid, JOIN(' ', "Thread Context Switches", _tid_name, "(S)"));
|
||||
_tid, fmt::format("Thread Context Switches {} (S)", _tid_name));
|
||||
if(get_valid(category::thread_page_fault{}, _valid))
|
||||
perfetto_counter_track<perfetto_rusage>::emplace(
|
||||
_tid, JOIN(' ', "Thread Page Faults", _tid_name, "(S)"));
|
||||
_tid, fmt::format("Thread Page Faults {} (S)", _tid_name));
|
||||
}
|
||||
|
||||
if(!perfetto_counter_track<hw_counters>::exists(_tid) &&
|
||||
@@ -410,7 +410,7 @@ backtrace_metrics::init_perfetto(int64_t _tid, valid_array_t _valid)
|
||||
fmt::format("Empty description for {}", itr.c_str()));
|
||||
}
|
||||
perfetto_counter_track<hw_counters>::emplace(
|
||||
_tid, JOIN(' ', "Thread", _desc, _tid_name, "(S)"));
|
||||
_tid, fmt::format("Thread {} {} (S)", _desc, _tid_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-3
@@ -42,9 +42,12 @@
|
||||
#include <timemory/mpl/concepts.hpp>
|
||||
#include <timemory/mpl/types.hpp>
|
||||
#include <timemory/utility/types.hpp>
|
||||
#include <tuple>
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
@@ -209,7 +212,7 @@ struct category_region : comp::base<category_region<CategoryT>, void>
|
||||
|
||||
static std::string label()
|
||||
{
|
||||
return JOIN('_', "rocprofsys", category_name, "region");
|
||||
return fmt::format("rocprofsys_{}_region", category_name);
|
||||
}
|
||||
|
||||
template <typename... OptsT, typename... Args>
|
||||
@@ -446,7 +449,9 @@ category_region<CategoryT>::audit(const gotcha_data_t& _data, audit::outgoing,
|
||||
{
|
||||
stop<OptsT...>(_data.tool_id.c_str(), [&](::perfetto::EventContext ctx) {
|
||||
if(config::get_perfetto_annotations())
|
||||
tracing::add_perfetto_annotation(ctx, "return", JOIN(", ", _args...));
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, "return",
|
||||
fmt::format("{}", fmt::join(std::forward_as_tuple(_args...), ", ")));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -475,7 +480,9 @@ category_region<CategoryT>::audit(std::string_view _name, audit::outgoing,
|
||||
{
|
||||
stop<OptsT...>(_name.data(), [&](::perfetto::EventContext ctx) {
|
||||
if(config::get_perfetto_annotations())
|
||||
tracing::add_perfetto_annotation(ctx, "return", JOIN(", ", _args...));
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, "return",
|
||||
fmt::format("{}", fmt::join(std::forward_as_tuple(_args...), ", ")));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+33
-41
@@ -49,9 +49,8 @@ write_perfetto_counter_track(uint64_t _val)
|
||||
auto _emplace = [](const size_t _idx) {
|
||||
if(!counter_track::exists(_idx))
|
||||
{
|
||||
std::string _label = (_idx > 0)
|
||||
? JOIN(" ", Tp::label, JOIN("", '[', _idx, ']'))
|
||||
: Tp::label;
|
||||
std::string _label =
|
||||
(_idx > 0) ? fmt::format(" {} [{}]", Tp::label, _idx) : Tp::label;
|
||||
counter_track::emplace(_idx, _label, "bytes");
|
||||
}
|
||||
};
|
||||
@@ -239,10 +238,9 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int cou
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _a{ _name };
|
||||
add(_a, count * _size);
|
||||
tracker_t _b{ JOIN('/', _name, JOIN('=', "dst", dst)) };
|
||||
tracker_t _b{ fmt::format("{}/dst={}", _name, dst) };
|
||||
add(_b, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', "dst", dst), JOIN('=', "tag", tag)),
|
||||
count * _size);
|
||||
add(fmt::format("{}/dst={}/tag={}", _name, dst, tag), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,10 +263,9 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, int count,
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _a{ _name };
|
||||
add(_a, count * _size);
|
||||
tracker_t _b{ JOIN('/', _name, JOIN('=', "dst", dst)) };
|
||||
tracker_t _b{ fmt::format("{}/dst={}", _name, dst) };
|
||||
add(_b, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', "dst", dst), JOIN('=', "tag", tag)),
|
||||
count * _size);
|
||||
add(fmt::format("{}/dst={}/tag={}", _name, dst, tag), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,10 +288,9 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int cou
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _a{ _name };
|
||||
add(_a, count * _size);
|
||||
tracker_t _b{ JOIN('/', _name, JOIN('=', "dst", dst)) };
|
||||
tracker_t _b{ fmt::format("{}/dst={}", _name, dst) };
|
||||
add(_b, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', "dst", dst), JOIN('=', "tag", tag)),
|
||||
count * _size);
|
||||
add(fmt::format("{}/dst={}/tag={}", _name, dst, tag), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,10 +313,9 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, int count,
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _a{ _name };
|
||||
add(_a, count * _size);
|
||||
tracker_t _b{ JOIN('/', _name, JOIN('=', "dst", dst)) };
|
||||
tracker_t _b{ fmt::format("{}/dst={}", _name, dst) };
|
||||
add(_b, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', "dst", dst), JOIN('=', "tag", tag)),
|
||||
count * _size);
|
||||
add(fmt::format("{}/dst={}/tag={}", _name, dst, tag), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +338,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, int count,
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', "root", root)), count * _size);
|
||||
add(fmt::format("{}/root={}", _name, root), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,23 +391,21 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int sen
|
||||
tracker_t _t{ _name };
|
||||
add(_t, sendcount * _send_size + recvcount * _recv_size);
|
||||
{
|
||||
tracker_t _b{ JOIN('/', _name, "send") };
|
||||
tracker_t _b{ fmt::format("{}/send", _name) };
|
||||
add(_b, sendcount * _send_size);
|
||||
tracker_t _c{ JOIN('/', _name, JOIN('=', "send", dst)) };
|
||||
tracker_t _c{ fmt::format("{}/send={}", _name, dst) };
|
||||
add(_b, sendcount * _send_size);
|
||||
add(JOIN('/', _name, "send", JOIN('=', "tag", sendtag)),
|
||||
sendcount * _send_size);
|
||||
add(JOIN('/', _name, JOIN('=', "send", dst), JOIN('=', "tag", sendtag)),
|
||||
add(fmt::format("{}/send={}/tag={}", _name, sendtag), sendcount * _send_size);
|
||||
add(fmt::format("{}/send={}/tag={}", _name, dst, sendtag),
|
||||
sendcount * _send_size);
|
||||
}
|
||||
{
|
||||
tracker_t _b{ JOIN('/', _name, "recv") };
|
||||
tracker_t _b{ fmt::format("{}/recv", _name) };
|
||||
add(_b, recvcount * _recv_size);
|
||||
tracker_t _c{ JOIN('/', _name, JOIN('=', "recv", src)) };
|
||||
tracker_t _c{ fmt::format("{}/recv={}", _name, src) };
|
||||
add(_b, recvcount * _recv_size);
|
||||
add(JOIN('/', _name, "recv", JOIN('=', "tag", recvtag)),
|
||||
recvcount * _recv_size);
|
||||
add(JOIN('/', _name, JOIN('=', "recv", src), JOIN('=', "tag", recvtag)),
|
||||
add(fmt::format("{}/recv={}/tag={}", _name, recvtag), recvcount * _recv_size);
|
||||
add(fmt::format("{}/recv={}/tag={}", _name, src, recvtag),
|
||||
recvcount * _recv_size);
|
||||
}
|
||||
}
|
||||
@@ -445,10 +438,10 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int sen
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, sendcount * _send_size + recvcount * _recv_size);
|
||||
tracker_t _r(JOIN('/', _name, JOIN('=', "root", root)));
|
||||
tracker_t _r(fmt::format("{}/root={}", _name, root));
|
||||
add(_r, sendcount * _send_size + recvcount * _recv_size);
|
||||
add(JOIN('/', _name, JOIN('=', "root", root), "send"), sendcount * _send_size);
|
||||
add(JOIN('/', _name, JOIN('=', "root", root), "recv"), recvcount * _recv_size);
|
||||
add(fmt::format("{}/root={}/send", _name, root), sendcount * _send_size);
|
||||
add(fmt::format("{}/root={}/recv", _name, root), recvcount * _recv_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,8 +471,8 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int sen
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, sendcount * _send_size + recvcount * _recv_size);
|
||||
add(JOIN('/', _name, "send"), sendcount * _send_size);
|
||||
add(JOIN('/', _name, "recv"), recvcount * _recv_size);
|
||||
add(fmt::format("{}/send", _name), sendcount * _send_size);
|
||||
add(fmt::format("{}/recv", _name), recvcount * _recv_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -505,7 +498,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, const void*,
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count);
|
||||
add(JOIN('/', _name, JOIN('=', "tag", tag)), count);
|
||||
add(fmt::format("{}/tag={}", _name, tag), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,9 +521,8 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, void*, size_t
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count);
|
||||
add(JOIN('/', _name, JOIN('=', "tag", tag)), count);
|
||||
add(JOIN('/', _name, JOIN('=', "tag", tag), JOIN('=', "tag_mask", tag_mask)),
|
||||
count);
|
||||
add(fmt::format("{}/tag={}", _name, tag), count);
|
||||
add(fmt::format("{}/tag={}/tag_mask={}", _name, tag, tag_mask), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +545,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, const void*,
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count);
|
||||
add(JOIN('/', _name, JOIN('=', "remote_addr", remote_addr)), count);
|
||||
add(fmt::format("{}/remote_addr={}", _name, remote_addr), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,7 +568,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, void*, size_t
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count);
|
||||
add(JOIN('/', _name, JOIN('=', "remote_addr", remote_addr)), count);
|
||||
add(fmt::format("{}/remote_addr={}", _name, remote_addr), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,7 +593,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, void*, unsigned id,
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, total_size);
|
||||
add(JOIN('/', _name, JOIN('=', "am_id", id)), total_size);
|
||||
add(fmt::format("{}/am_id={}", _name, id), total_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +789,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, const v
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', "root", root)), count * _size);
|
||||
add(fmt::format("{}/root={}", _name, root), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,7 +830,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, size_t
|
||||
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count * _size);
|
||||
add(JOIN('/', _name, JOIN('=', _label, peer)), count * _size);
|
||||
add(fmt::format("{}/{}={}", _name, _label, peer), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,7 +850,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, const v
|
||||
auto _name = std::string_view{ _data.tool_id };
|
||||
tracker_t _t{ _name };
|
||||
add(_t, count * _size);
|
||||
add(JOIN('/', _data.tool_id, JOIN('=', "root", root)), count * _size);
|
||||
add(fmt::format("{}/root={}", _data.tool_id, root), count * _size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "common/join.hpp"
|
||||
#include "core/common.hpp"
|
||||
#include "core/components/fwd.hpp"
|
||||
#include "core/defines.hpp"
|
||||
|
||||
+7
-3
@@ -33,8 +33,12 @@
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <tuple>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace rocprofsys
|
||||
{
|
||||
@@ -64,13 +68,13 @@ invoke_exit_gotcha(const exit_gotcha::gotcha_data& _data, FuncT _func, Args... _
|
||||
if(get_state() < State::Finalized && !is_child_process())
|
||||
{
|
||||
LOG_DEBUG("Finalizing {} before calling {}({})...", get_exe_name(), _data.tool_id,
|
||||
JOIN(", ", _args...).c_str());
|
||||
fmt::join(std::forward_as_tuple(_args...), ", "));
|
||||
|
||||
rocprofsys_finalize();
|
||||
}
|
||||
|
||||
LOG_DEBUG("Calling {}({}) in {}...", _data.tool_id, JOIN(", ", _args...),
|
||||
get_exe_name());
|
||||
LOG_DEBUG("Calling {}({}) in {}...", _data.tool_id,
|
||||
fmt::join(std::forward_as_tuple(_args...), ", "), get_exe_name().c_str());
|
||||
|
||||
if(_exit_info.is_known && _exit_info.exit_code != 0)
|
||||
{
|
||||
|
||||
+1
-2
@@ -148,8 +148,7 @@ numa_gotcha::audit(const gotcha_data& _data, audit::incoming, int pid,
|
||||
struct bitmask* from, struct bitmask* to)
|
||||
{
|
||||
category_region<category::numa>::start(std::string_view{ _data.tool_id }, "pid", pid,
|
||||
"from", JOIN("", from).c_str(), "to",
|
||||
JOIN("", to).c_str());
|
||||
"from", fmt::ptr(from), "to", fmt::ptr(to));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+3
-4
@@ -243,14 +243,13 @@ pthread_create_gotcha::wrapper::operator()() const
|
||||
LOG_DEBUG("[PID={}][rank={}] Thread {} (parent: {}) created", process::get_id(),
|
||||
dmp::rank(), _info->index_data->as_string(),
|
||||
_parent_info->index_data->as_string());
|
||||
threading::set_thread_name(TIMEMORY_JOIN(" ", "Thread", _tid).c_str());
|
||||
threading::set_thread_name(fmt::format("Thread {}", _tid).c_str());
|
||||
auto _manager = tim::manager::instance();
|
||||
if(_manager) _manager->initialize();
|
||||
if(!thread_bundle_data_t::get()->at(_tid))
|
||||
{
|
||||
thread_data<thread_bundle_t>::construct(
|
||||
TIMEMORY_JOIN('/', "rocprofsys/process", process::get_id(), "thread",
|
||||
_tid),
|
||||
fmt::format("rocprofsys/process/{}/thread/{}", process::get_id(), _tid),
|
||||
quirk::config<quirk::auto_start>{});
|
||||
thread_bundle_data_t::get()->at(_tid)->start();
|
||||
}
|
||||
@@ -607,7 +606,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr,
|
||||
std::to_string(_use_causal), std::to_string(_use_sampling),
|
||||
std::to_string(_sample_child), std::to_string(_tid),
|
||||
std::to_string(_use_bundle), std::to_string(_enable_causal),
|
||||
std::to_string(_enable_sampling), JOIN("", *_info));
|
||||
std::to_string(_enable_sampling), _info->as_string());
|
||||
|
||||
std::stringstream _backtrace_ss;
|
||||
timemory_print_demangled_backtrace<8>(_backtrace_ss, std::string{},
|
||||
|
||||
@@ -239,7 +239,7 @@ post_process()
|
||||
// if(get_debug() && get_verbose() >= 2)
|
||||
if(true)
|
||||
{
|
||||
auto _addr = TIMEMORY_JOIN("", "0x", std::hex, itr.address);
|
||||
auto _addr = fmt::format("0x{:x}", itr.address);
|
||||
ofs << std::setw(8) << itr.count << " " << std::setw(8) << _addr
|
||||
<< " " << itr.source << "\n";
|
||||
}
|
||||
|
||||
@@ -300,7 +300,9 @@ config_perfetto_counter_tracks(type_list<Types...>, std::array<const char*, N> _
|
||||
constexpr auto _idx = tim::index_of<type, type_list<Types...>>::value;
|
||||
if(!track::exists(0))
|
||||
{
|
||||
auto addendum = [&](const char* _v) { return JOIN(" ", "CPU", _v, "(S)"); };
|
||||
auto addendum = [&](const char* _v) {
|
||||
return fmt::format("CPU [{}] (S)", _v);
|
||||
};
|
||||
track::emplace(0, addendum(_labels.at(_idx)), _units.at(_idx));
|
||||
}
|
||||
};
|
||||
@@ -351,7 +353,7 @@ post_process()
|
||||
if(!freq_track::exists(_idx))
|
||||
{
|
||||
auto addendum = [&](const char* _v) {
|
||||
return JOIN(" ", "CPU", _v, JOIN("", '[', _idx, ']'), "(S)");
|
||||
return fmt::format("CPU {} [{}] (S)", _v, _idx);
|
||||
};
|
||||
freq_track::emplace(_idx, addendum("Frequency"), "MHz");
|
||||
}
|
||||
|
||||
@@ -356,8 +356,8 @@ extern "C"
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
auto pname = (devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? JOIN(" ", _kp_prefix, name, "[for]")
|
||||
: JOIN(" ", _kp_prefix, name, JOIN("", "[for][dev", devid, ']'));
|
||||
? fmt::format("{} {} [for]", _kp_prefix, name)
|
||||
: fmt::format("{} {} [for][dev{}]", _kp_prefix, name, devid);
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
kokkosp::logger_t{}.mark(1, __FUNCTION__, name, *kernid);
|
||||
kokkosp::create_profiler<kokkosp_region>(pname, *kernid);
|
||||
@@ -381,11 +381,10 @@ extern "C"
|
||||
if(violates_name_rules(name)) return set_invalid_id(kernid);
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
auto pname =
|
||||
(devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? JOIN(" ", _kp_prefix, name, "[reduce]")
|
||||
: JOIN(" ", _kp_prefix, name, JOIN("", "[reduce][dev", devid, ']'));
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
auto pname = (devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? fmt::format("{} {} [reduce]", _kp_prefix, name)
|
||||
: fmt::format("{} {} [reduce][dev{}]", _kp_prefix, name, devid);
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
kokkosp::logger_t{}.mark(1, __FUNCTION__, name, *kernid);
|
||||
kokkosp::create_profiler<kokkosp_region>(pname, *kernid);
|
||||
kokkosp::start_profiler<kokkosp_region>(*kernid);
|
||||
@@ -408,11 +407,10 @@ extern "C"
|
||||
if(violates_name_rules(name)) return set_invalid_id(kernid);
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
auto pname =
|
||||
(devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? JOIN(" ", _kp_prefix, name, "[scan]")
|
||||
: JOIN(" ", _kp_prefix, name, JOIN("", "[scan][dev", devid, ']'));
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
auto pname = (devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? fmt::format("{} {} [scan]", _kp_prefix, name)
|
||||
: fmt::format("{} {} [scan][dev{}]", _kp_prefix, name, devid);
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
kokkosp::logger_t{}.mark(1, __FUNCTION__, name, *kernid);
|
||||
kokkosp::create_profiler<kokkosp_region>(pname, *kernid);
|
||||
kokkosp::start_profiler<kokkosp_region>(*kernid);
|
||||
@@ -435,11 +433,10 @@ extern "C"
|
||||
if(violates_name_rules(name)) return set_invalid_id(kernid);
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
auto pname =
|
||||
(devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? JOIN(" ", _kp_prefix, name, "[fence]")
|
||||
: JOIN(" ", _kp_prefix, name, JOIN("", "[fence][dev", devid, ']'));
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
auto pname = (devid > std::numeric_limits<uint16_t>::max()) // junk device number
|
||||
? fmt::format("{} {} [fence]", _kp_prefix, name)
|
||||
: fmt::format("{} {} [fence][dev{}]", _kp_prefix, name, devid);
|
||||
*kernid = kokkosp::get_unique_id();
|
||||
kokkosp::logger_t{}.mark(1, __FUNCTION__, name, *kernid);
|
||||
kokkosp::create_profiler<kokkosp_region>(pname, *kernid);
|
||||
kokkosp::start_profiler<kokkosp_region>(*kernid);
|
||||
@@ -517,9 +514,8 @@ extern "C"
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
kokkosp::logger_t{}.mark(0, __FUNCTION__, space.name, label,
|
||||
JOIN("", '[', ptr, ']'), size);
|
||||
auto pname =
|
||||
JOIN(" ", _kp_prefix, label, JOIN("", '[', space.name, "][allocate]"));
|
||||
fmt::format("[{}]", ptr), size);
|
||||
auto pname = fmt::format("{} {} [allocate][{}]", _kp_prefix, label, space.name);
|
||||
kokkosp::profiler_alloc_t<>{ pname }.store(std::plus<int64_t>{}, size);
|
||||
kokkosp::profiler_t<kokkosp_region>{ pname }.mark();
|
||||
}
|
||||
@@ -532,9 +528,8 @@ extern "C"
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
kokkosp::logger_t{}.mark(0, __FUNCTION__, space.name, label,
|
||||
JOIN("", '[', ptr, ']'), size);
|
||||
auto pname =
|
||||
JOIN(" ", _kp_prefix, label, JOIN("", '[', space.name, "][deallocate]"));
|
||||
fmt::format("[{}]", ptr), size);
|
||||
auto pname = fmt::format("{} {} [deallocate][{}]", _kp_prefix, label, space.name);
|
||||
kokkosp::profiler_alloc_t<>{ pname }.store(std::plus<int64_t>{}, size);
|
||||
kokkosp::profiler_t<kokkosp_region>{ pname }.mark();
|
||||
}
|
||||
@@ -550,11 +545,11 @@ extern "C"
|
||||
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
kokkosp::logger_t{}.mark(1, __FUNCTION__, dst_handle.name, dst_name,
|
||||
JOIN("", '[', dst_ptr, ']'), src_handle.name, src_name,
|
||||
JOIN("", '[', src_ptr, ']'), size);
|
||||
fmt::format("[{}]", dst_ptr), src_handle.name, src_name,
|
||||
fmt::format("[{}]", src_ptr), size);
|
||||
|
||||
auto name = JOIN(" ", _kp_prefix, JOIN('=', dst_handle.name, dst_name), "<-",
|
||||
JOIN('=', src_handle.name, src_name), "[deep_copy]");
|
||||
auto name = fmt::format("{} {} <- {} [deep_copy]", _kp_prefix, dst_handle.name,
|
||||
dst_name, src_handle.name, src_name);
|
||||
|
||||
auto& _data = kokkosp::get_profiler_stack<kokkosp_region>();
|
||||
_data.emplace_back(name);
|
||||
@@ -599,20 +594,22 @@ extern "C"
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
if(rocprofsys::config::get_use_perfetto())
|
||||
{
|
||||
auto _name = tim::get_hash_identifier_fast(
|
||||
tim::add_hash_id(JOIN(" ", _kp_prefix, label, "[dual_view_sync]")));
|
||||
auto _name = tim::get_hash_identifier_fast(tim::add_hash_id(
|
||||
fmt::format("{} {} [dual_view_sync]", _kp_prefix, label)));
|
||||
TRACE_EVENT_INSTANT("user", ::perfetto::StaticString{ _name.data() },
|
||||
"target", (is_device) ? "device" : "host");
|
||||
}
|
||||
else if(rocprofsys::config::get_use_causal())
|
||||
{
|
||||
auto _name = tim::get_hash_identifier_fast(tim::add_hash_id(JOIN(
|
||||
"", label, " [dual_view_sync][", (is_device) ? "device" : "host", "]")));
|
||||
auto _name = tim::get_hash_identifier_fast(
|
||||
tim::add_hash_id(fmt::format("{} {} [dual_view_sync][{}]", _kp_prefix,
|
||||
label, (is_device) ? "device" : "host")));
|
||||
kokkosp::profiler_t<kokkosp_region>{ _name }.mark();
|
||||
}
|
||||
|
||||
cache_kokkos_event(JOIN(" ", _kp_prefix, label).c_str(), "[dual_view_sync]",
|
||||
(is_device) ? "device" : "host", timestamp);
|
||||
cache_kokkos_event(fmt::format("{} {}", _kp_prefix, label).c_str(),
|
||||
"[dual_view_sync]", (is_device) ? "device" : "host",
|
||||
timestamp);
|
||||
}
|
||||
|
||||
void kokkosp_dual_view_modify(const char* label, const void* const, bool is_device)
|
||||
@@ -623,21 +620,22 @@ extern "C"
|
||||
ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal);
|
||||
if(rocprofsys::config::get_use_perfetto())
|
||||
{
|
||||
auto _name = tim::get_hash_identifier_fast(
|
||||
tim::add_hash_id(JOIN(" ", _kp_prefix, label, "[dual_view_modify]")));
|
||||
auto _name = tim::get_hash_identifier_fast(tim::add_hash_id(
|
||||
fmt::format("{} {} [dual_view_modify]", _kp_prefix, label)));
|
||||
TRACE_EVENT_INSTANT("user", ::perfetto::StaticString{ _name.data() },
|
||||
"target", (is_device) ? "device" : "host");
|
||||
}
|
||||
else if(rocprofsys::config::get_use_causal())
|
||||
{
|
||||
auto _name = tim::get_hash_identifier_fast(
|
||||
tim::add_hash_id(JOIN(" ", _kp_prefix, label, "[dual_view_modify][",
|
||||
(is_device) ? "device" : "host", "]")));
|
||||
tim::add_hash_id(fmt::format("{} {} [dual_view_modify][{}]", _kp_prefix,
|
||||
label, (is_device) ? "device" : "host")));
|
||||
kokkosp::profiler_t<kokkosp_region>{ _name }.mark();
|
||||
}
|
||||
|
||||
cache_kokkos_event(JOIN(" ", _kp_prefix, label).c_str(), "[dual_view_modify]",
|
||||
(is_device) ? "device" : "host", timestamp);
|
||||
cache_kokkos_event(fmt::format("{} {}", _kp_prefix, label).c_str(),
|
||||
"[dual_view_modify]", (is_device) ? "device" : "host",
|
||||
timestamp);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------//
|
||||
|
||||
@@ -74,11 +74,11 @@ auto _thread_pool_cfg = []() {
|
||||
_v.use_tbb = false;
|
||||
_v.verbose = -1;
|
||||
_v.initializer = []() {
|
||||
thread_info::init(true);
|
||||
threading::set_thread_name(
|
||||
JOIN('.', "ptl", PTL::Threading::GetThreadId()).c_str());
|
||||
set_thread_state(ThreadState::Disabled);
|
||||
sampling::block_signals();
|
||||
rocprofsys::thread_info::init(true);
|
||||
tim::threading::set_thread_name(
|
||||
fmt::format("ptl.{}", PTL::Threading::GetThreadId()).c_str());
|
||||
rocprofsys::set_thread_state(rocprofsys::ThreadState::Disabled);
|
||||
rocprofsys::sampling::block_signals();
|
||||
};
|
||||
_v.finalizer = []() {};
|
||||
_v.priority = 5;
|
||||
|
||||
+55
-57
@@ -66,6 +66,7 @@
|
||||
#include <timemory/utility/types.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
@@ -290,10 +291,8 @@ create_agent_profile(rocprofiler_agent_id_t agent_id,
|
||||
|
||||
if(counters_v.size() != expected_v)
|
||||
{
|
||||
auto requested_counters =
|
||||
timemory::join::join(timemory::join::array_config{ ", ", "", "" }, counters);
|
||||
auto found_counters =
|
||||
timemory::join::join(timemory::join::array_config{ ", ", "", "" }, found_v);
|
||||
auto requested_counters = fmt::format("{}", fmt::join(counters, ", "));
|
||||
auto found_counters = fmt::format("{}", fmt::join(found_v, ", "));
|
||||
|
||||
// Determine which counters were not found
|
||||
auto missing_counters = std::vector<std::string>{};
|
||||
@@ -302,8 +301,7 @@ create_agent_profile(rocprofiler_agent_id_t agent_id,
|
||||
if(std::find(found_v.begin(), found_v.end(), counter) == found_v.end())
|
||||
missing_counters.emplace_back(counter);
|
||||
}
|
||||
auto missing_counters_str = timemory::join::join(
|
||||
timemory::join::array_config{ ", ", "", "" }, missing_counters);
|
||||
auto missing_counters_str = fmt::format("{}", fmt::join(missing_counters, ", "));
|
||||
|
||||
// In production, warn and continue with available counters
|
||||
LOG_WARNING("Unable to find all counters for agent {} (gpu-{}, {}). "
|
||||
@@ -424,13 +422,13 @@ get_backtrace(std::optional<std::vector<tim::unwind::processed_entry>>& _bt_data
|
||||
const auto* _loc = (_linfo && !_linfo.location.empty())
|
||||
? &_linfo.location
|
||||
: ((itr.location.empty()) ? &_unk : &itr.location);
|
||||
auto _line =
|
||||
(_linfo && _linfo.line > 0)
|
||||
? join("", _linfo.line)
|
||||
: ((itr.lineno == 0) ? std::string{ "?" } : join("", itr.lineno));
|
||||
auto _entry = join("", rocprofsys::utility::demangle(*_func), " @ ",
|
||||
join(':', ::basename(_loc->c_str()), _line));
|
||||
backtrace[join("", "frame#", _bt_cnt++)] = _entry;
|
||||
auto _line = (_linfo && _linfo.line > 0)
|
||||
? fmt::format("{}", _linfo.line)
|
||||
: ((itr.lineno == 0) ? std::string{ "?" }
|
||||
: fmt::format("{}", itr.lineno));
|
||||
auto _entry = fmt::format("{} @ {}:{}", rocprofsys::utility::demangle(*_func),
|
||||
::basename(_loc->c_str()), _line);
|
||||
backtrace[fmt::format("frame#{}", _bt_cnt++)] = _entry;
|
||||
}
|
||||
}
|
||||
return backtrace;
|
||||
@@ -846,25 +844,26 @@ tool_tracing_callback_stop(
|
||||
(_linfo && !_linfo.location.empty())
|
||||
? &_linfo.location
|
||||
: ((itr.location.empty()) ? &_unk : &itr.location);
|
||||
auto _line = (_linfo && _linfo.line > 0)
|
||||
? join("", _linfo.line)
|
||||
: ((itr.lineno == 0) ? std::string{ "?" }
|
||||
: join("", itr.lineno));
|
||||
auto _entry =
|
||||
join("", rocprofsys::utility::demangle(*_func), " @ ",
|
||||
join(':', ::basename(_loc->c_str()), _line));
|
||||
auto _line =
|
||||
(_linfo && _linfo.line > 0)
|
||||
? fmt::format("{}", _linfo.line)
|
||||
: ((itr.lineno == 0) ? std::string{ "?" }
|
||||
: fmt::format("{}", itr.lineno));
|
||||
auto _entry = fmt::format(
|
||||
"{} @ {}:{}", rocprofsys::utility::demangle(*_func),
|
||||
::basename(_loc->c_str()), _line);
|
||||
if(_bt_cnt < 10)
|
||||
{
|
||||
// Prepend zero for better ordering in UI. Only one
|
||||
// zero is ever necessary since stack depth is limited
|
||||
// to 16.
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, join("", "frame#0", _bt_cnt++), _entry);
|
||||
ctx, fmt::format("frame#0{}", _bt_cnt++), _entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, join("", "frame#", _bt_cnt++), _entry);
|
||||
ctx, fmt::format("frame#{}", _bt_cnt++), _entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1219,24 +1218,25 @@ ompt_tracing_callback_stop(
|
||||
(_linfo && !_linfo.location.empty())
|
||||
? &_linfo.location
|
||||
: ((itr.location.empty()) ? &_unk : &itr.location);
|
||||
auto _line = (_linfo && _linfo.line > 0)
|
||||
? join("", _linfo.line)
|
||||
: ((itr.lineno == 0) ? std::string{ "?" }
|
||||
: join("", itr.lineno));
|
||||
auto _entry =
|
||||
join("", rocprofsys::utility::demangle(*_func), " @ ",
|
||||
join(':', ::basename(_loc->c_str()), _line));
|
||||
auto _line =
|
||||
(_linfo && _linfo.line > 0)
|
||||
? fmt::format("{}", _linfo.line)
|
||||
: ((itr.lineno == 0) ? std::string{ "?" }
|
||||
: fmt::format("{}", itr.lineno));
|
||||
auto _entry = fmt::format("{} @ {}:{}",
|
||||
rocprofsys::utility::demangle(*_func),
|
||||
::basename(_loc->c_str()), _line);
|
||||
if(_bt_cnt < 10)
|
||||
{
|
||||
// Prepend zero for better ordering in UI. Only one zero
|
||||
// is ever necessary since stack depth is limited to 16.
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, join("", "frame#0", _bt_cnt++), _entry);
|
||||
ctx, fmt::format("frame#0{}", _bt_cnt++), _entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, join("", "frame#", _bt_cnt++), _entry);
|
||||
ctx, fmt::format("frame#{}", _bt_cnt++), _entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1644,7 +1644,7 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
if(num_headers == 0 || headers == nullptr) return;
|
||||
|
||||
auto _track_desc_stream = [](uint64_t _stream_id) {
|
||||
return JOIN("", "HIP Activity Stream ", _stream_id);
|
||||
return fmt::format("HIP Activity Stream {}", _stream_id);
|
||||
};
|
||||
|
||||
const bool _default_group_by_queue = get_group_by_queue();
|
||||
@@ -1687,8 +1687,8 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
{
|
||||
cache_category<category::rocm_kernel_dispatch>();
|
||||
cache_add_thread_info(record->thread_id);
|
||||
cache_add_track(JOIN("", "GPU Kernel Dispatch [", _agent->device_id,
|
||||
"] Queue ", _queue_id.handle)
|
||||
cache_add_track(fmt::format("GPU Kernel Dispatch [{}] Queue {}",
|
||||
_agent->device_id, _queue_id.handle)
|
||||
.c_str(),
|
||||
record->thread_id);
|
||||
cache_kernel_dispatch(record, _stream_id);
|
||||
@@ -1735,26 +1735,24 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
record->dispatch_info.group_segment_size);
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, "workgroup_size",
|
||||
JOIN("", "(",
|
||||
JOIN(',', record->dispatch_info.workgroup_size.x,
|
||||
record->dispatch_info.workgroup_size.y,
|
||||
record->dispatch_info.workgroup_size.z),
|
||||
")"));
|
||||
fmt::format("({},{},{})",
|
||||
record->dispatch_info.workgroup_size.x,
|
||||
record->dispatch_info.workgroup_size.y,
|
||||
record->dispatch_info.workgroup_size.z));
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, "grid_size",
|
||||
JOIN("", "(",
|
||||
JOIN(',', record->dispatch_info.grid_size.x,
|
||||
record->dispatch_info.grid_size.y,
|
||||
record->dispatch_info.grid_size.z),
|
||||
")"));
|
||||
fmt::format("({},{},{})",
|
||||
record->dispatch_info.grid_size.x,
|
||||
record->dispatch_info.grid_size.y,
|
||||
record->dispatch_info.grid_size.z));
|
||||
}
|
||||
};
|
||||
|
||||
if(_group_by_queue)
|
||||
{
|
||||
auto _track_desc = [](int32_t _device_id_v, int64_t _queue_id_v) {
|
||||
return JOIN("", "GPU Kernel Dispatch [", _device_id_v,
|
||||
"] Queue ", _queue_id_v);
|
||||
return fmt::format("GPU Kernel Dispatch [{}] Queue {}",
|
||||
_device_id_v, _queue_id_v);
|
||||
};
|
||||
|
||||
const auto _track = tracing::get_perfetto_track(
|
||||
@@ -1812,8 +1810,8 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
}
|
||||
|
||||
{
|
||||
auto track_name = JOIN("", "GPU Scratch Memory [", device_id,
|
||||
"] Thread ", record->thread_id);
|
||||
auto track_name = fmt::format("GPU Scratch Memory [{}] Thread {}",
|
||||
device_id, record->thread_id);
|
||||
cache_category<category::rocm_scratch_memory>();
|
||||
cache_add_thread_info(record->thread_id);
|
||||
cache_add_track(track_name.c_str(), record->thread_id);
|
||||
@@ -1843,8 +1841,8 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
if(!counter_track::exists(device_id))
|
||||
{
|
||||
auto track_name_alloc_size =
|
||||
JOIN("", "GPU Scratch Memory [", device_id, "] (S) Thread ",
|
||||
thread_id_sequent);
|
||||
fmt::format("GPU Scratch Memory [{}] (S) Thread {}",
|
||||
device_id, thread_id_sequent);
|
||||
counter_track::emplace(device_id, track_name_alloc_size, "bytes");
|
||||
}
|
||||
|
||||
@@ -1869,8 +1867,8 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
if(_group_by_queue)
|
||||
{
|
||||
auto track_name_events = [&]() {
|
||||
return JOIN("", "GPU Scratch Memory (S) Events Thread ",
|
||||
thread_id_sequent);
|
||||
return fmt::format("GPU Scratch Memory (S) Events Thread {}",
|
||||
thread_id_sequent);
|
||||
};
|
||||
const auto _track = tracing::get_perfetto_track(
|
||||
category::rocm_scratch_memory{}, track_name_events);
|
||||
@@ -1927,9 +1925,8 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
size_t thread_idx = record->thread_id;
|
||||
std::string track_name;
|
||||
|
||||
track_name =
|
||||
JOIN("", "GPU Memory Copy to Agent [",
|
||||
_dst_agent->logical_node_id, "] Thread ", thread_idx);
|
||||
track_name = fmt::format("GPU Memory Copy to Agent [{}] Thread {}",
|
||||
_dst_agent->logical_node_id, thread_idx);
|
||||
|
||||
cache_category<category::rocm_memory_copy>();
|
||||
cache_add_track(track_name.c_str(), record->thread_id);
|
||||
@@ -1974,8 +1971,9 @@ tool_tracing_buffered(rocprofiler_context_id_t /*context*/,
|
||||
auto _track_desc = [](int32_t _device_id_v,
|
||||
rocprofiler_thread_id_t _tid) {
|
||||
const auto& _tid_v = thread_info::get(_tid, SystemTID);
|
||||
return JOIN("", "GPU Memory Copy to Agent [", _device_id_v,
|
||||
"] Thread ", _tid_v->index_data->sequent_value);
|
||||
return fmt::format("GPU Memory Copy to Agent [{}] Thread {}",
|
||||
_device_id_v,
|
||||
_tid_v->index_data->sequent_value);
|
||||
};
|
||||
|
||||
const auto _track = tracing::get_perfetto_track(
|
||||
|
||||
+3
-3
@@ -146,7 +146,7 @@ counter_storage::counter_storage(const client_data* _tool_data, uint64_t _devid,
|
||||
auto _metric_name = std::string{ _name };
|
||||
_metric_name =
|
||||
std::regex_replace(_metric_name, std::regex{ "(.*)\\[([0-9]+)\\]" }, "$1_$2");
|
||||
storage_name = JOIN('-', "rocprof", "device", device_id, _metric_name);
|
||||
storage_name = fmt::format("rocprof-device-{}-{}", device_id, _metric_name);
|
||||
storage = std::make_unique<counter_storage_type>(tim::standalone_storage{}, index,
|
||||
storage_name);
|
||||
tim::manager::instance()->add_cleanup(
|
||||
@@ -158,8 +158,8 @@ counter_storage::counter_storage(const client_data* _tool_data, uint64_t _devid,
|
||||
|
||||
{
|
||||
constexpr auto _unit = ::perfetto::CounterTrack::Unit::UNIT_COUNT;
|
||||
track_name = JOIN(" ", "GPU", _metric_name, JOIN("", '[', device_id, ']'));
|
||||
track = std::make_unique<counter_track_type>(
|
||||
track_name = fmt::format(" GPU {} [{}]", _metric_name, device_id);
|
||||
track = std::make_unique<counter_track_type>(
|
||||
::perfetto::StaticString(track_name.c_str()));
|
||||
|
||||
metadata_initialize_counter_category();
|
||||
|
||||
+15
-16
@@ -23,8 +23,6 @@
|
||||
#include "library/rocprofiler-sdk/fwd.hpp"
|
||||
#include "core/state.hpp"
|
||||
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
#include "logger/debug.hpp"
|
||||
|
||||
#include <exception>
|
||||
@@ -33,6 +31,8 @@
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
#include <spdlog/fmt/ranges.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
@@ -171,11 +171,11 @@ client_data::initialize_event_info()
|
||||
{
|
||||
auto _dev_index = aitr.device_id;
|
||||
const auto& _agent_id = rocprofiler_agent_id_t{ aitr.agent->handle };
|
||||
auto _device_qualifier_sym = JOIN("", ":device=", _dev_index);
|
||||
auto _device_qualifier_sym = fmt::format(":device={}", _dev_index);
|
||||
auto _device_qualifier =
|
||||
tim::hardware_counters::qualifier{ true, static_cast<int>(_dev_index),
|
||||
_device_qualifier_sym,
|
||||
JOIN(" ", "Device", _dev_index) };
|
||||
fmt::format("Device {}", _dev_index) };
|
||||
|
||||
// Check if agent info is available ( i.e., counters are supported)
|
||||
auto agent_info_it = agent_counter_info.find(_agent_id);
|
||||
@@ -219,8 +219,9 @@ client_data::initialize_event_info()
|
||||
}
|
||||
else if(ditr.is_derived)
|
||||
{
|
||||
auto _sym = JOIN("", ditr.name, _device_qualifier_sym);
|
||||
auto _short_desc = JOIN("", "Derived counter: ", ditr.expression);
|
||||
auto _sym = fmt::format("{}:device={}", ditr.name, _dev_index);
|
||||
auto _short_desc =
|
||||
fmt::format("Derived counter: {}", ditr.expression);
|
||||
events_info.emplace_back(hardware_counter_info(
|
||||
true, tim::hardware_counters::api::rocm, events_info.size(), 0,
|
||||
_sym, _pysym, _short_desc, _long_desc, _units,
|
||||
@@ -232,21 +233,19 @@ client_data::initialize_event_info()
|
||||
|
||||
for(const auto& itr : ditr.dimension_info)
|
||||
{
|
||||
auto _info = (itr.instance_size > 1)
|
||||
? JOIN("", itr.name, "[", 0, ":",
|
||||
itr.instance_size - 1, "]")
|
||||
: std::string{};
|
||||
auto _info =
|
||||
(itr.instance_size > 1)
|
||||
? fmt::format("{}[0:{}]", itr.name, itr.instance_size - 1)
|
||||
: std::string{};
|
||||
if(!_info.empty()) _dim_info.emplace_back(_info);
|
||||
}
|
||||
|
||||
auto _sym = JOIN("", ditr.name, _device_qualifier_sym);
|
||||
auto _short_desc = JOIN("", ditr.name, " on device ", _dev_index);
|
||||
auto _sym = fmt::format("{}:device={}", ditr.name, _dev_index);
|
||||
auto _short_desc =
|
||||
fmt::format("{} on device {}", ditr.name, _dev_index);
|
||||
if(!_dim_info.empty())
|
||||
{
|
||||
namespace join = ::timemory::join;
|
||||
_short_desc += JOIN(
|
||||
"", ". ",
|
||||
join::join(join::array_config{ ", ", "", "" }, _dim_info));
|
||||
_short_desc += fmt::format("{}", fmt::join(_dim_info, ". "));
|
||||
}
|
||||
events_info.emplace_back(hardware_counter_info(
|
||||
true, tim::hardware_counters::api::rocm, events_info.size(), 0,
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ write_perfetto_counter_track(uint64_t _val, uint64_t _begin_ts, uint64_t _end_ts
|
||||
if(!counter_track::exists(_idx))
|
||||
{
|
||||
std::string _label =
|
||||
(_idx > 0) ? JOIN(" ", Tp::label, JOIN("", '[', _idx, ']')) : Tp::label;
|
||||
(_idx > 0) ? fmt::format("{} [{}]", Tp::label, _idx) : Tp::label;
|
||||
counter_track::emplace(_idx, _label, "bytes");
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ cache_rccl_comm_data_events(size_t bytes, uint64_t timestamp_ns)
|
||||
static_cast<double>(cumulative_bytes) });
|
||||
}
|
||||
|
||||
static auto
|
||||
inline auto
|
||||
rccl_type_size(ncclDataType_t datatype)
|
||||
{
|
||||
switch(datatype)
|
||||
|
||||
@@ -209,7 +209,7 @@ get_main_bundle()
|
||||
auto _self = RUSAGE_SELF;
|
||||
std::swap(_self, tim::get_rusage_type());
|
||||
auto _tmp = std::make_unique<main_bundle_t>(
|
||||
JOIN('/', "rocprofsys/process", process::get_id()),
|
||||
fmt::format("rocprofsys/process/{}", process::get_id()),
|
||||
quirk::config<quirk::auto_start>{});
|
||||
std::swap(_self, tim::get_rusage_type());
|
||||
return _tmp;
|
||||
@@ -221,7 +221,7 @@ std::unique_ptr<init_bundle_t>&
|
||||
get_init_bundle()
|
||||
{
|
||||
static auto _v = std::make_unique<init_bundle_t>(
|
||||
JOIN('/', "rocprofsys/process", process::get_id()));
|
||||
fmt::format("rocprofsys/process/{}", process::get_id()));
|
||||
return _v;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ get_preinit_bundle()
|
||||
{
|
||||
static auto _v =
|
||||
(setup_gotchas(), std::make_unique<preinit_bundle_t>(
|
||||
JOIN('/', "rocprofsys/process", process::get_id()),
|
||||
fmt::format("rocprofsys/process/{}", process::get_id()),
|
||||
quirk::config<quirk::auto_start>{}));
|
||||
return _v;
|
||||
}
|
||||
|
||||
@@ -1411,13 +1411,14 @@ post_process_perfetto(int64_t _tid, const std::vector<timer_sampling_data>& _tim
|
||||
_overflow_event.substr(_overflow_pos + _overflow_prefix.length());
|
||||
|
||||
const auto* _main_name =
|
||||
static_strings.emplace(join(" ", _overflow_event, "samples [rocprof-sys]"))
|
||||
static_strings
|
||||
.emplace(fmt::format("{} samples [rocprof-sys]", _overflow_event))
|
||||
.first->c_str();
|
||||
|
||||
auto _track = tracing::get_perfetto_track(
|
||||
category::overflow_sampling{},
|
||||
[](auto _seq_id, auto _sys_id) {
|
||||
return TIMEMORY_JOIN(" ", "Thread", _seq_id, "Overflow", "(S)", _sys_id);
|
||||
return fmt::format("Thread {} Overflow (S) {}", _seq_id, _sys_id);
|
||||
},
|
||||
_thread_info->index_data->sequent_value,
|
||||
_thread_info->index_data->system_value);
|
||||
@@ -1461,12 +1462,13 @@ post_process_perfetto(int64_t _tid, const std::vector<timer_sampling_data>& _tim
|
||||
size_t _n = 0;
|
||||
for(const auto& line : _lines)
|
||||
{
|
||||
auto _label = JOIN('-', "lineinfo", _n++);
|
||||
auto _label = fmt::format("lineinfo-{}", _n++);
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, _label.c_str(),
|
||||
JOIN('@',
|
||||
rocprofsys::utility::demangle(line.name),
|
||||
JOIN(':', line.location, line.line)));
|
||||
fmt::format(
|
||||
"{}@{}:{}",
|
||||
rocprofsys::utility::demangle(line.name),
|
||||
line.location, line.line));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1494,7 +1496,7 @@ post_process_perfetto(int64_t _tid, const std::vector<timer_sampling_data>& _tim
|
||||
auto _track = tracing::get_perfetto_track(
|
||||
category::timer_sampling{},
|
||||
[](auto _seq_id, auto _sys_id) {
|
||||
return TIMEMORY_JOIN(" ", "Thread", _seq_id, "(S)", _sys_id);
|
||||
return fmt::format("Thread {} (S) {}", _seq_id, _sys_id);
|
||||
},
|
||||
_thread_info->index_data->sequent_value,
|
||||
_thread_info->index_data->system_value);
|
||||
@@ -1559,7 +1561,7 @@ post_process_perfetto(int64_t _tid, const std::vector<timer_sampling_data>& _tim
|
||||
static_strings
|
||||
.emplace(rocprofsys::utility::demangle(line.name))
|
||||
.first->c_str();
|
||||
auto _info = JOIN(':', line.location, line.line);
|
||||
auto _info = fmt::format("{}:{}", line.location, line.line);
|
||||
tracing::push_perfetto_track(
|
||||
category::timer_sampling{}, _name, _track, _beg,
|
||||
[&](::perfetto::EventContext ctx) {
|
||||
@@ -1602,12 +1604,13 @@ post_process_perfetto(int64_t _tid, const std::vector<timer_sampling_data>& _tim
|
||||
size_t _n = 0;
|
||||
for(const auto& line : _lines)
|
||||
{
|
||||
auto _label = JOIN('-', "lineinfo", _n++);
|
||||
auto _label = fmt::format("lineinfo-{}", _n++);
|
||||
tracing::add_perfetto_annotation(
|
||||
ctx, _label.c_str(),
|
||||
JOIN('@',
|
||||
rocprofsys::utility::demangle(line.name),
|
||||
JOIN(':', line.location, line.line)));
|
||||
fmt::format(
|
||||
"{}@{}:{}",
|
||||
rocprofsys::utility::demangle(line.name),
|
||||
line.location, line.line));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,15 +173,15 @@ thread_init()
|
||||
{
|
||||
LOG_CRITICAL("thread setup failed. thread info not initialized: {}",
|
||||
[&_tinfo]() {
|
||||
if(_tinfo) return JOIN("", *_tinfo);
|
||||
if(_tinfo) return _tinfo->as_string();
|
||||
return std::string{ "no thread_info" };
|
||||
}());
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
if(_tidx > 0) threading::set_thread_name(JOIN(" ", "Thread", _tidx).c_str());
|
||||
if(_tidx > 0) threading::set_thread_name(fmt::format("Thread {}", _tidx).c_str());
|
||||
thread_data<thread_bundle_t>::construct(
|
||||
JOIN('/', "rocprofsys/process", process::get_id(), "thread", _tidx),
|
||||
fmt::format("rocprofsys/process/{}/thread/{}", process::get_id(), _tidx),
|
||||
quirk::config<quirk::auto_start>{});
|
||||
// save the hash maps
|
||||
get_timemory_hash_ids(_tidx) = tim::get_hash_ids();
|
||||
|
||||
@@ -161,9 +161,9 @@ template <typename CategoryT, typename... Args>
|
||||
auto
|
||||
get_perfetto_category_uuid(Args&&... _args)
|
||||
{
|
||||
return tim::hash::get_hash_id(
|
||||
tim::hash::get_hash_id(JOIN('_', "rocprofsys", trait::name<CategoryT>::value)),
|
||||
std::forward<Args>(_args)...);
|
||||
return tim::hash::get_hash_id(tim::hash::get_hash_id(fmt::format(
|
||||
"rocprofsys_{}", trait::name<CategoryT>::value)),
|
||||
std::forward<Args>(_args)...);
|
||||
}
|
||||
|
||||
template <typename CategoryT, typename TrackT = ::perfetto::Track, typename FuncT,
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ add_perfetto_annotation(
|
||||
auto* _dbg = ctx.event()->add_debug_annotations();
|
||||
if(_idx >= 0)
|
||||
{
|
||||
auto _arg_name = JOIN("", "arg", _idx, "-", std::forward<Np>(_name));
|
||||
auto _arg_name = fmt::format("arg{}-{}", _idx, std::forward<Np>(_name));
|
||||
_dbg->set_name(_arg_name);
|
||||
}
|
||||
else
|
||||
@@ -136,7 +136,7 @@ add_perfetto_annotation(
|
||||
}
|
||||
else if constexpr(concepts::can_stringify<value_type>::value)
|
||||
{
|
||||
_get_dbg()->set_string_value(JOIN("", std::forward<Tp>(_val)));
|
||||
_get_dbg()->set_string_value(fmt::format("{}", std::forward<Tp>(_val)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
مرجع در شماره جدید
Block a user