diff --git a/tools/unitrace/src/levelzero/ze_collector.h b/tools/unitrace/src/levelzero/ze_collector.h index cf74969..ee08782 100644 --- a/tools/unitrace/src/levelzero/ze_collector.h +++ b/tools/unitrace/src/levelzero/ze_collector.h @@ -4001,7 +4001,7 @@ class ZeCollector { } void AggregateDeviceTimeStats() const { - // do not acquire global_device_time_stats_mutex_. caller dos it. + // do not acquire global_device_time_stats_mutex_. caller does it. for (auto it = global_device_time_stats_->begin(); it != global_device_time_stats_->end(); it++) { std::string kname; if (it->first.tile_ >= 0) { diff --git a/tools/unitrace/src/tracer.h b/tools/unitrace/src/tracer.h index 75b45b5..281b9d1 100644 --- a/tools/unitrace/src/tracer.h +++ b/tools/unitrace/src/tracer.h @@ -203,6 +203,13 @@ class UniTracer { ~UniTracer() { total_execution_time_ = correlator_.GetTimestamp(); + if (ze_collector_ != nullptr) { + ze_collector_->DisableTracing(); + delete ze_collector_; + } + + // report after ze_collector_ is destructed + // local stats are sweeped in deconstructor Report(); ClExtCollector::Destroy(); @@ -213,14 +220,6 @@ class UniTracer { cl_gpu_collector_->DisableTracing(); } - if (ze_collector_ != nullptr) { - ze_collector_->DisableTracing(); - } - - if (ze_collector_ != nullptr) { - delete ze_collector_; - } - if (itt_collector != nullptr){ // Print CCL summary before deleting the object // If CCL summary is not enbled summary string will be empty