Improve error message for invalid extra counters YAML format (#219)

When users provide an incorrectly formatted YAML file to the -E/--extra-counters
option in rocprofv3, they now receive a clear error message showing:

- What went wrong (invalid YAML format)
- The correct rocprofiler-sdk YAML structure with example
- The actual content that failed to parse

This addresses confusion where users might use the legacy ROCProfiler YAML
format instead of the new rocprofiler-sdk schema format.
This commit is contained in:
Benjamin Welton
2025-09-23 20:23:57 -07:00
committed by GitHub
parent d0e622e978
commit 9743ff0c74
@@ -141,6 +141,23 @@ loadYAML(const std::string& filename, std::optional<ArchMetric> add_metric)
header.push_back(counter);
}
}
else
{
ROCP_ERROR << "Invalid extra counters YAML format. Expected structure:\n"
<< "rocprofiler-sdk:\n"
<< " counters-schema-version: 1\n"
<< " counters:\n"
<< " - name: COUNTER_NAME\n"
<< " description: 'Counter description'\n"
<< " properties: []\n"
<< " definitions:\n"
<< " - architectures:\n"
<< " - gfx942\n"
<< " block: BLOCK_NAME\n"
<< " event: EVENT_ID\n"
<< "Got:\n"
<< override.data;
}
}
for(const auto& counter : header)