Skip to content
Closed
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
38 changes: 33 additions & 5 deletions src/view/src/compute/rocprofvis_compute_table_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,12 @@ ComputeTableView::RenderCategory(const AvailableMetrics::Category& cat)
category_has_data = true;

int value_columns = std::max(1, static_cast<int>(tbl.value_names.size()));
int num_columns = 1 + value_columns + 1; // Metric + values + Unit
int num_columns = 1 + 1 + value_columns + 1; // ID + Metric + values + Unit

ImGui::SeparatorText(tbl.name.c_str());
if(ImGui::BeginTable("##t", num_columns, ImGuiTableFlags_Borders))
{
ImGui::TableSetupColumn("Metric ID");
ImGui::TableSetupColumn("Metric");
if(tbl.value_names.empty())
{
Expand All @@ -258,9 +259,24 @@ ComputeTableView::RenderCategory(const AvailableMetrics::Category& cat)
uint32_t eid = entry_pair.first;
const auto& entry = entry_pair.second;

std::string metric_id = std::to_string(cat.id) + "." +
std::to_string(tbl_id) + "." +
std::to_string(eid);
Comment on lines +262 to +264
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to not have to do this concatenation every frame


ImGui::PushID(static_cast<int>(eid));
ImGui::TableNextRow();

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

ImGui::TableNextColumn();
CopyableTextUnformatted(entry.name.c_str(), "##name",
COPY_DATA_NOTIFICATION, false, true);
if(!entry.description.empty() && ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", entry.description.c_str());
}

if(tbl.value_names.empty())
{
Expand All @@ -269,7 +285,10 @@ ComputeTableView::RenderCategory(const AvailableMetrics::Category& cat)
m_client_id, kernel_id, cat.id, tbl_id, eid);
if(mv && mv->entry && !mv->values.empty())
{
ImGui::Text("%.2f", mv->values.begin()->second);
char buf[64];
snprintf(buf, sizeof(buf), "%.2f", mv->values.begin()->second);
Comment on lines +288 to +289
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid memcopy every frame?

CopyableTextUnformatted(buf, "##val",
COPY_DATA_NOTIFICATION, false, true);
}
else
{
Expand All @@ -278,31 +297,40 @@ ComputeTableView::RenderCategory(const AvailableMetrics::Category& cat)
}
else
{
int vi = 0;
for(const auto& vn : tbl.value_names)
{
ImGui::TableNextColumn();
auto mv = model.GetMetricValue(
m_client_id, kernel_id, cat.id, tbl_id, eid);
if(mv && mv->entry && mv->values.count(vn))
{
ImGui::Text("%.2f", mv->values.at(vn));
char buf[64];
snprintf(buf, sizeof(buf), "%.2f", mv->values.at(vn));
CopyableTextUnformatted(
buf, "##v" + std::to_string(vi),
COPY_DATA_NOTIFICATION, false, true);
}
else
{
ImGui::TextDisabled("N/A");
}
vi++;
}
}

ImGui::TableNextColumn();
if(!entry.unit.empty())
{
ImGui::TextUnformatted(entry.unit.c_str());
CopyableTextUnformatted(entry.unit.c_str(), "##unit",
COPY_DATA_NOTIFICATION, false, true);
}
else
{
ImGui::TextDisabled("N/A");
}

ImGui::PopID();
}
ImGui::EndTable();
}
Expand Down