From d0c470be2e573e9f82d54d13807726b0a8cca89d Mon Sep 17 00:00:00 2001 From: Jiho Choi Date: Fri, 28 Feb 2020 12:20:03 -0800 Subject: [PATCH] Use uint32 for tid. PiperOrigin-RevId: 297901590 Change-Id: Id5d03f41f0442f8c7a18b668b7267e6d8c727583 --- tensorflow/core/profiler/internal/traceme_recorder.cc | 4 ++-- tensorflow/core/profiler/internal/traceme_recorder.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tensorflow/core/profiler/internal/traceme_recorder.cc b/tensorflow/core/profiler/internal/traceme_recorder.cc index d4e937728c3..365e3992bc3 100644 --- a/tensorflow/core/profiler/internal/traceme_recorder.cc +++ b/tensorflow/core/profiler/internal/traceme_recorder.cc @@ -196,12 +196,12 @@ class TraceMeRecorder::ThreadLocalRecorder { return singleton; } -void TraceMeRecorder::RegisterThread(int32 tid, ThreadLocalRecorder* thread) { +void TraceMeRecorder::RegisterThread(uint32 tid, ThreadLocalRecorder* thread) { mutex_lock lock(mutex_); threads_.emplace(tid, thread); } -void TraceMeRecorder::UnregisterThread(int32 tid) { +void TraceMeRecorder::UnregisterThread(uint32 tid) { mutex_lock lock(mutex_); auto it = threads_.find(tid); if (it != threads_.end()) { diff --git a/tensorflow/core/profiler/internal/traceme_recorder.h b/tensorflow/core/profiler/internal/traceme_recorder.h index 9836e716532..561368dd431 100644 --- a/tensorflow/core/profiler/internal/traceme_recorder.h +++ b/tensorflow/core/profiler/internal/traceme_recorder.h @@ -59,7 +59,7 @@ class TraceMeRecorder { uint64 end_time; // 0 = missing }; struct ThreadInfo { - int32 tid; + uint32 tid; string name; }; struct ThreadEvents { @@ -101,8 +101,8 @@ class TraceMeRecorder { TF_DISALLOW_COPY_AND_ASSIGN(TraceMeRecorder); - void RegisterThread(int32 tid, ThreadLocalRecorder* thread); - void UnregisterThread(int32 tid); + void RegisterThread(uint32 tid, ThreadLocalRecorder* thread); + void UnregisterThread(uint32 tid); bool StartRecording(int level); Events StopRecording(); @@ -113,7 +113,7 @@ class TraceMeRecorder { mutex mutex_; // Map of the static container instances (thread_local storage) for each // thread. While active, a ThreadLocalRecorder stores trace events. - absl::flat_hash_map threads_ GUARDED_BY(mutex_); + absl::flat_hash_map threads_ GUARDED_BY(mutex_); // Events from threads that died during recording. TraceMeRecorder::Events orphaned_events_ GUARDED_BY(mutex_); };