Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions src/view/src/widgets/rocprofvis_compute_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ MetricTableCache::Populate(const AvailableMetrics::Table& table,
m_rows.clear();
m_rows.reserve(table.entries.size());

m_column_names.push_back("Metric ID");
m_column_names.push_back("Metric");
if(table.value_names.empty())
{
Expand All @@ -404,8 +405,12 @@ MetricTableCache::Populate(const AvailableMetrics::Table& table,
const auto& entry = entry_pair.second;

Row row;
row.name = entry.name;
row.unit = entry.unit.empty() ? "N/A" : entry.unit;
row.metric_id = std::to_string(entry.category_id) + "." +
std::to_string(entry.table_id) + "." +
std::to_string(eid);
row.name = entry.name;
row.description = entry.description;
row.unit = entry.unit.empty() ? "N/A" : entry.unit;

auto mv = get_value(eid);

Expand Down Expand Up @@ -457,18 +462,32 @@ MetricTableCache::Render() const
ImGui::TableSetupColumn(col.c_str());
ImGui::TableHeadersRow();

int row_idx = 0;
for(const auto& row : m_rows)
{
ImGui::PushID(row_idx++);
ImGui::TableNextRow();

ImGui::TableNextColumn();
ImGui::TextUnformatted(row.name.c_str());
CopyableTextUnformatted(row.metric_id.c_str(), "##mid",
COPY_DATA_NOTIFICATION, false, true);

for(const auto& val : row.values)
ImGui::TableNextColumn();
CopyableTextUnformatted(row.name.c_str(), "##name",
COPY_DATA_NOTIFICATION, false, true);
if(!row.description.empty() && ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", row.description.c_str());
}

for(int vi = 0; vi < static_cast<int>(row.values.size()); vi++)
{
ImGui::TableNextColumn();
if(!val.empty())
if(!row.values[vi].empty())
{
ImGui::TextUnformatted(val.c_str());
CopyableTextUnformatted(row.values[vi].c_str(),
std::string("##v") + std::to_string(vi),
COPY_DATA_NOTIFICATION, false, true);
}
else
{
Expand All @@ -479,12 +498,15 @@ MetricTableCache::Render() const
ImGui::TableNextColumn();
if(row.unit != "N/A")
{
ImGui::TextUnformatted(row.unit.c_str());
CopyableTextUnformatted(row.unit.c_str(), "##unit",
COPY_DATA_NOTIFICATION, false, true);
}
else
{
ImGui::TextDisabled("N/A");
}

ImGui::PopID();
}
ImGui::EndTable();
}
Expand Down
6 changes: 4 additions & 2 deletions src/view/src/widgets/rocprofvis_compute_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ class MetricTableCache

struct Row
{
std::string name;
std::vector<std::string> values;
std::string metric_id;
std::string name;
std::string description;
std::vector<std::string> values;
std::string unit;
};

Expand Down