<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/system/thread_id.cpp, branch CLI_2.32.0</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=CLI_2.32.0</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=CLI_2.32.0'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-06-06T21:16:49Z</updated>
<entry>
<title>Cache process/thread id getters and use them in TError origin capture</title>
<updated>2026-06-06T21:16:49Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-06T20:52:00Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=f10c7206fb31af8057446bceef9707aabaa9456e'/>
<id>urn:sha1:f10c7206fb31af8057446bceef9707aabaa9456e</id>
<content type='text'>
## 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 &gt;= 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
</content>
</entry>
<entry>
<title>YT-21566: Access thread local variables via noinline functions</title>
<updated>2024-04-25T23:41:13Z</updated>
<author>
<name>lukyan</name>
<email>lukyan@yandex-team.com</email>
</author>
<published>2024-04-25T23:21:44Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=5bbe44ff4e12b6d5496d56ecca97b0c4db340509'/>
<id>urn:sha1:5bbe44ff4e12b6d5496d56ecca97b0c4db340509</id>
<content type='text'>
970c33b44a7bd166b2716d86d3d2053dcaf05d7d
</content>
</entry>
<entry>
<title>Use volatile TLS in library/cpp/yt</title>
<updated>2023-12-05T17:50:57Z</updated>
<author>
<name>lukyan</name>
<email>lukyan@yandex-team.com</email>
</author>
<published>2023-12-05T16:07:41Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=d5b84ed65f77eab0135b9d0ee025556f4507b62b'/>
<id>urn:sha1:d5b84ed65f77eab0135b9d0ee025556f4507b62b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix ya.make</title>
<updated>2022-07-07T11:41:37Z</updated>
<author>
<name>monster</name>
<email>monster@ydb.tech</email>
</author>
<published>2022-07-07T11:41:37Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=06e5c21a835c0e923506c4ff27929f34e00761c2'/>
<id>urn:sha1:06e5c21a835c0e923506c4ff27929f34e00761c2</id>
<content type='text'>
</content>
</entry>
</feed>
