2
0

fixed querying of available metrics to use correct agnet name

Change-Id: Ic2c82d5cba760ba5b0caa373e5309f17c908b8e9
Este cometimento está contido em:
Evgeny
2019-10-03 10:04:51 -05:00
cometido por Evgeny Shcherbakov
ascendente 363107b09e
cometimento d8bd1f5ae5
2 ficheiros modificados com 14 adições e 4 eliminações
+13 -1
Ver ficheiro
@@ -171,11 +171,20 @@ class MetricsDict {
const_iterator_t Begin() const { return cache_.begin(); } const_iterator_t Begin() const { return cache_.begin(); }
const_iterator_t End() const { return cache_.end(); } const_iterator_t End() const { return cache_.end(); }
std::string GetAgentName() const { return agent_name_; }
xml::Xml::nodes_t GetNodes() const {
auto nodes_vec = GetNodes(agent_name_);
auto global_vec = GetNodes("global");
nodes_vec.insert(nodes_vec.end(), global_vec.begin(), global_vec.end());
return nodes_vec;
}
private:
xml::Xml::nodes_t GetNodes(const std::string& scope) const { xml::Xml::nodes_t GetNodes(const std::string& scope) const {
return (xml_ != NULL) ? xml_->GetNodes("top." + scope + ".metric") : xml::Xml::nodes_t(); return (xml_ != NULL) ? xml_->GetNodes("top." + scope + ".metric") : xml::Xml::nodes_t();
} }
private:
MetricsDict(const util::AgentInfo* agent_info) : xml_(NULL), agent_info_(agent_info) { MetricsDict(const util::AgentInfo* agent_info) : xml_(NULL), agent_info_(agent_info) {
const char* xml_name = getenv("ROCP_METRICS"); const char* xml_name = getenv("ROCP_METRICS");
if (xml_name != NULL) { if (xml_name != NULL) {
@@ -186,11 +195,13 @@ class MetricsDict {
xml_->AddConst("top.const.metric", "SIMD_NUM", agent_info->simds_per_cu * agent_info->cu_num); xml_->AddConst("top.const.metric", "SIMD_NUM", agent_info->simds_per_cu * agent_info->cu_num);
xml_->AddConst("top.const.metric", "SE_NUM", agent_info->se_num); xml_->AddConst("top.const.metric", "SE_NUM", agent_info->se_num);
ImportMetrics(agent_info, "const"); ImportMetrics(agent_info, "const");
agent_name_ = agent_info->name;
if (std::string("gfx906") == agent_info->name) { if (std::string("gfx906") == agent_info->name) {
ImportMetrics(agent_info, agent_info->name); ImportMetrics(agent_info, agent_info->name);
} else if (std::string("gfx908") == agent_info->name) { } else if (std::string("gfx908") == agent_info->name) {
ImportMetrics(agent_info, agent_info->name); ImportMetrics(agent_info, agent_info->name);
} else { } else {
agent_name_ = agent_info->gfxip;
ImportMetrics(agent_info, agent_info->gfxip); ImportMetrics(agent_info, agent_info->gfxip);
} }
ImportMetrics(agent_info, "global"); ImportMetrics(agent_info, "global");
@@ -327,6 +338,7 @@ class MetricsDict {
xml::Xml* xml_; xml::Xml* xml_;
const util::AgentInfo* agent_info_; const util::AgentInfo* agent_info_;
std::string agent_name_;
cache_t cache_; cache_t cache_;
static map_t* map_; static map_t* map_;
+1 -3
Ver ficheiro
@@ -738,9 +738,7 @@ PUBLIC_API hsa_status_t rocprofiler_iterate_info(
case ROCPROFILER_INFO_KIND_METRIC: case ROCPROFILER_INFO_KIND_METRIC:
{ {
const rocprofiler::MetricsDict* dict = rocprofiler::GetMetrics(agent_info->dev_id); const rocprofiler::MetricsDict* dict = rocprofiler::GetMetrics(agent_info->dev_id);
auto nodes_vec = dict->GetNodes(agent_info->gfxip); auto nodes_vec = dict->GetNodes();
auto global_vec = dict->GetNodes("global");
nodes_vec.insert(nodes_vec.end(), global_vec.begin(), global_vec.end());
for (auto* node : nodes_vec) { for (auto* node : nodes_vec) {
const std::string& name = node->opts["name"]; const std::string& name = node->opts["name"];