MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetCachedTID

Function GetCachedTID

tensorflow/core/profiler/internal/gpu/cupti_tracer.cc:85–89  ·  view source on GitHub ↗

GetCachedTID() caches the thread ID in thread-local storage (which is a userspace construct) to avoid unnecessary system calls. Without this caching, it can take roughly 98ns, while it takes roughly 1ns with this caching.

Source from the content-addressed store, hash-verified

83// userspace construct) to avoid unnecessary system calls. Without this caching,
84// it can take roughly 98ns, while it takes roughly 1ns with this caching.
85pid_t GetCachedTID() {
86 static thread_local pid_t current_thread_id =
87 Env::Default()->GetCurrentThreadId();
88 return current_thread_id;
89}
90
91size_t Bytes2D(const CUDA_MEMCPY2D *p) { return p->Height * p->WidthInBytes; }
92

Callers 4

Calls 2

DefaultFunction · 0.85
GetCurrentThreadIdMethod · 0.45

Tested by

no test coverage detected