Use uint32 for tid.

PiperOrigin-RevId: 297901590
Change-Id: Id5d03f41f0442f8c7a18b668b7267e6d8c727583
This commit is contained in:
Jiho Choi 2020-02-28 12:20:03 -08:00 committed by TensorFlower Gardener
parent 9a4a5569e4
commit d0c470be2e
2 changed files with 6 additions and 6 deletions

View File

@ -196,12 +196,12 @@ class TraceMeRecorder::ThreadLocalRecorder {
return singleton; return singleton;
} }
void TraceMeRecorder::RegisterThread(int32 tid, ThreadLocalRecorder* thread) { void TraceMeRecorder::RegisterThread(uint32 tid, ThreadLocalRecorder* thread) {
mutex_lock lock(mutex_); mutex_lock lock(mutex_);
threads_.emplace(tid, thread); threads_.emplace(tid, thread);
} }
void TraceMeRecorder::UnregisterThread(int32 tid) { void TraceMeRecorder::UnregisterThread(uint32 tid) {
mutex_lock lock(mutex_); mutex_lock lock(mutex_);
auto it = threads_.find(tid); auto it = threads_.find(tid);
if (it != threads_.end()) { if (it != threads_.end()) {

View File

@ -59,7 +59,7 @@ class TraceMeRecorder {
uint64 end_time; // 0 = missing uint64 end_time; // 0 = missing
}; };
struct ThreadInfo { struct ThreadInfo {
int32 tid; uint32 tid;
string name; string name;
}; };
struct ThreadEvents { struct ThreadEvents {
@ -101,8 +101,8 @@ class TraceMeRecorder {
TF_DISALLOW_COPY_AND_ASSIGN(TraceMeRecorder); TF_DISALLOW_COPY_AND_ASSIGN(TraceMeRecorder);
void RegisterThread(int32 tid, ThreadLocalRecorder* thread); void RegisterThread(uint32 tid, ThreadLocalRecorder* thread);
void UnregisterThread(int32 tid); void UnregisterThread(uint32 tid);
bool StartRecording(int level); bool StartRecording(int level);
Events StopRecording(); Events StopRecording();
@ -113,7 +113,7 @@ class TraceMeRecorder {
mutex mutex_; mutex mutex_;
// Map of the static container instances (thread_local storage) for each // Map of the static container instances (thread_local storage) for each
// thread. While active, a ThreadLocalRecorder stores trace events. // thread. While active, a ThreadLocalRecorder stores trace events.
absl::flat_hash_map<int32, ThreadLocalRecorder*> threads_ GUARDED_BY(mutex_); absl::flat_hash_map<uint32, ThreadLocalRecorder*> threads_ GUARDED_BY(mutex_);
// Events from threads that died during recording. // Events from threads that died during recording.
TraceMeRecorder::Events orphaned_events_ GUARDED_BY(mutex_); TraceMeRecorder::Events orphaned_events_ GUARDED_BY(mutex_);
}; };