Skip to content

Commit

Permalink
Fix nullptr when doing nested profileing
Browse files Browse the repository at this point in the history
  • Loading branch information
panyx0718 authored and Xin Pan committed Mar 11, 2018
1 parent 6272b57 commit a4b801c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions paddle/fluid/platform/device_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ class DeviceTracerImpl : public DeviceTracer {
}

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

0 comments on commit a4b801c

Please sign in to comment.