summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/system/process_id.h
Commit message (Collapse)AuthorAgeFilesLines
* Cache process/thread id getters and use them in TError origin capturebabenko2 days1-0/+22
## Motivation Profiling the YT master Automaton thread showed TOriginAttributes::Capture (run on every non-OK TError) spending ~60% of its time in a getpid() syscall — uncached on glibc >= 2.25. NYT::GetCurrentThreadId() (gettid) feeds hot thread-affinity / log-manager checks on the same thread. ## Changes - New library/cpp/yt/system/process_id.* with cached GetProcessId(); GetSystemThreadId() now caches the kernel tid in TLS. Both caches reset in the child after fork. - Moved thread_name.{h,cpp} from misc to system. - Removed GetCurrentProcessId/GetCurrentThreadId shims from yt/yt/core/misc/proc.{h,cpp}; migrated all callers to NYT::GetProcessId / NYT::GetSystemThreadId. - TOriginAttributes::Capture uses the cached getters; recorded Tid is now the real kernel tid (matches perf/ps). - Added microbenchmarks (library/cpp/yt/system/benchmarks, yt/yt/core/benchmarks/error.cpp). ## Microbenchmarks (release) | | before | after | |---|---|---| | getpid | 101 ns | 0.33 ns | | gettid | 102 ns | 1.64 ns | | Capture | 161 ns | 50 ns | | failed TError | 221 ns | 74 ns | commit_hash:ee37ae57d61a5a2dd33daee935270f4bb93b7ff9