Fix hardware counter summary files not being generated after profiling (#124)
- Register a cleanup function in tim::manager instance to write out data in counter storages - The counter_storage::write() calls in tool_fini happen after the storage is destroyed which is too late for the write to happen. - Adjust traits for counter_data_tracker - Add MIN, MAX, VAR, STDDEV columns - Remove DEPTH, UNITS, %SELF columns - Update "add_validation_test" to test for the existence of output file(s). - Added step to test perfetto output for `transpose-rocprofiler-sampling` and `transpose-rocprofiler-binary-rewrite` --------- Co-authored-by: David Galiffi <David.Galiffi@amd.com>
This commit is contained in:
@@ -104,6 +104,12 @@ counter_storage::counter_storage(const client_data* _tool_data, uint64_t _devid,
|
||||
storage_name = JOIN('-', "rocprof", "device", device_id, _metric_name);
|
||||
storage = std::make_unique<counter_storage_type>(tim::standalone_storage{}, index,
|
||||
storage_name);
|
||||
tim::manager::instance()->add_cleanup(
|
||||
storage_name + "cleanup", [storage_ptr = storage.get(), metric_name = metric_name,
|
||||
metric_description = metric_description]() {
|
||||
if(storage_ptr)
|
||||
counter_storage::write(storage_ptr, metric_name, metric_description);
|
||||
});
|
||||
{
|
||||
constexpr auto _unit = ::perfetto::CounterTrack::Unit::UNIT_COUNT;
|
||||
track_name = JOIN(" ", "GPU", _metric_name, JOIN("", '[', device_id, ']'));
|
||||
@@ -124,7 +130,8 @@ counter_storage::operator()(const counter_event& _event, timing_interval _timing
|
||||
}
|
||||
|
||||
void
|
||||
counter_storage::write() const
|
||||
counter_storage::write(counter_storage_type* storage, std::string metric_name,
|
||||
std::string metric_description)
|
||||
{
|
||||
if(!trait::runtime_enabled<counter_data_tracker>::get())
|
||||
{
|
||||
@@ -134,7 +141,7 @@ counter_storage::write() const
|
||||
return;
|
||||
}
|
||||
|
||||
operation::set_storage<counter_data_tracker>{}(storage.get());
|
||||
operation::set_storage<counter_data_tracker>{}(storage);
|
||||
counter_data_tracker::label() = metric_name;
|
||||
counter_data_tracker::description() = metric_description;
|
||||
storage->write();
|
||||
|
||||
Reference in New Issue
Block a user