Fix an application crash when collecting performance counters with rocprofiler (#117)

* Add check to skip counter_storage::write() if internal storage field is destroyed.
* Output warning message if counter data is not available when trying to write out to Timemory

---------

Co-authored-by: David Galiffi <David.Galiffi@amd.com>
Этот коммит содержится в:
Sohaib Nadeem
2025-02-27 14:34:52 -05:00
коммит произвёл GitHub
родитель 3bea1d8eac
Коммит 43f900d01e
+8
Просмотреть файл
@@ -126,6 +126,14 @@ counter_storage::operator()(const counter_event& _event, timing_interval _timing
void
counter_storage::write() const
{
if(!trait::runtime_enabled<counter_data_tracker>::get())
{
ROCPROFSYS_WARNING_F(
1, "%s counter_data_tracker is disabled. Can't write storage.\n",
metric_name.c_str());
return;
}
operation::set_storage<counter_data_tracker>{}(storage.get());
counter_data_tracker::label() = metric_name;
counter_data_tracker::description() = metric_description;