diff options
| author | babenko <[email protected]> | 2026-06-06 23:52:00 +0300 |
|---|---|---|
| committer | babenko <[email protected]> | 2026-06-07 00:16:49 +0300 |
| commit | f10c7206fb31af8057446bceef9707aabaa9456e (patch) | |
| tree | e3283bfe824beda100b4a598006fdbc2fe221725 /contrib/tools/python3/Python/thread_pthread.h | |
| parent | 51122ce7f1b07aa13c32b9977a8aad5759854b15 (diff) | |
Cache process/thread id getters and use them in TError origin capture
## 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
Diffstat (limited to 'contrib/tools/python3/Python/thread_pthread.h')
0 files changed, 0 insertions, 0 deletions
