diff options
author | 2018-04-30 04:21:09 -0700 | |
---|---|---|
committer | 2018-04-30 04:23:46 -0700 | |
commit | 914796d5e9bc7b0c619b53c7eb24cfe7d6c7fb9b (patch) | |
tree | 17a2ec7b1a0902ebaf25451a418825e834e57571 /tensorflow/core/lib/core | |
parent | c2186af6c28f8817122b27f0cd29e16daeae68f1 (diff) |
Cleaning up tracing code.
PiperOrigin-RevId: 194768567
Diffstat (limited to 'tensorflow/core/lib/core')
-rw-r--r-- | tensorflow/core/lib/core/threadpool.cc | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tensorflow/core/lib/core/threadpool.cc b/tensorflow/core/lib/core/threadpool.cc index e55ed79d36..99684ae47b 100644 --- a/tensorflow/core/lib/core/threadpool.cc +++ b/tensorflow/core/lib/core/threadpool.cc @@ -59,10 +59,9 @@ struct EigenEnvironment { Task CreateTask(std::function<void()> f) { uint64 id = 0; - if (port::Tracing::IsActive()) { - id = port::Tracing::UniqueId(); - port::Tracing::RecordEvent(port::Tracing::EventCategory::kScheduleClosure, - id); + if (tracing::EventCollector::IsEnabled()) { + id = tracing::GetUniqueArg(); + tracing::RecordEvent(tracing::EventCategory::kScheduleClosure, id); } return Task{ std::unique_ptr<TaskImpl>(new TaskImpl{ @@ -75,13 +74,9 @@ struct EigenEnvironment { void ExecuteTask(const Task& t) { WithContext wc(t.f->context); - if (t.f->trace_id != 0) { - port::Tracing::ScopedActivity region( - port::Tracing::EventCategory::kRunClosure, t.f->trace_id); - t.f->f(); - } else { - t.f->f(); - } + tracing::ScopedRegion region(tracing::EventCategory::kRunClosure, + t.f->trace_id); + t.f->f(); } }; |