Skip to content

Commit 98ac929

Browse files
authored
Merge pull request #8782 from panyx0718/fix
Fix nullptr when doing nested profiling
2 parents ea4e6c7 + f10152d commit 98ac929

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

paddle/fluid/platform/device_tracer.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ class DeviceTracerImpl : public DeviceTracer {
192192
}
193193

194194
void AddCPURecords(const char *anno, uint64_t start_ns, uint64_t end_ns) {
195+
if (!anno) {
196+
// TODO(panyx0718): Currently, it doesn't support nested situation
197+
// Up-level can be cleared by low-level and therefore get nullptr
198+
// here.
199+
return;
200+
}
195201
std::lock_guard<std::mutex> l(trace_mu_);
196202
cpu_records_.push_back(
197203
CPURecord{anno, start_ns, end_ns,

0 commit comments

Comments
 (0)