zlogger: use cache for gettid() to reduce logging hot path overhead 72/283172/5
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 19 Oct 2022 15:48:35 +0000 (17:48 +0200)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 19 Oct 2022 16:22:56 +0000 (18:22 +0200)
commit15f0193f99dd8a859fe427684f2d0993fe2a5455
tree2dc3b9604695396cdb92b21b6f223774fcbbb274
parent8287fe15bddc3578b4ddf0ee855bf762243c5e18
zlogger: use cache for gettid() to reduce logging hot path overhead

Use thread local variable to cache gettid() calls and clear it with
pthread_atfork() hook. This reduces the logging hot path overhead by
avoiding any kernel calls.

On RPi4 this reduced a test message logging time (averaged) from 2.2us
to 0.8us.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8ed74a4442d76183f2403861ac3c428fd9b5b051
src/libdlog/log_zero_copy.c