Skip to content

Commit c60f92b

Browse files
authored
Report summary stats after L0 collector is destructed (#44)
* Report summary stats after L0 collector is destructed * Combine the two checks and fix a typo
1 parent 166eeba commit c60f92b

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tools/unitrace/src/levelzero/ze_collector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4001,7 +4001,7 @@ class ZeCollector {
40014001
}
40024002

40034003
void AggregateDeviceTimeStats() const {
4004-
// do not acquire global_device_time_stats_mutex_. caller dos it.
4004+
// do not acquire global_device_time_stats_mutex_. caller does it.
40054005
for (auto it = global_device_time_stats_->begin(); it != global_device_time_stats_->end(); it++) {
40064006
std::string kname;
40074007
if (it->first.tile_ >= 0) {

tools/unitrace/src/tracer.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ class UniTracer {
203203
~UniTracer() {
204204
total_execution_time_ = correlator_.GetTimestamp();
205205

206+
if (ze_collector_ != nullptr) {
207+
ze_collector_->DisableTracing();
208+
delete ze_collector_;
209+
}
210+
211+
// report after ze_collector_ is destructed
212+
// local stats are sweeped in deconstructor
206213
Report();
207214

208215
ClExtCollector::Destroy();
@@ -213,14 +220,6 @@ class UniTracer {
213220
cl_gpu_collector_->DisableTracing();
214221
}
215222

216-
if (ze_collector_ != nullptr) {
217-
ze_collector_->DisableTracing();
218-
}
219-
220-
if (ze_collector_ != nullptr) {
221-
delete ze_collector_;
222-
}
223-
224223
if (itt_collector != nullptr){
225224
// Print CCL summary before deleting the object
226225
// If CCL summary is not enbled summary string will be empty

0 commit comments

Comments
 (0)