tsan: make mem profile data more consistent
authorDmitry Vyukov <dvyukov@google.com>
Tue, 21 Sep 2021 09:31:18 +0000 (11:31 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 22 Sep 2021 08:16:15 +0000 (10:16 +0200)
commit58a157cd3b54942283a301019dceb65be2da85f7
treea012df6ea2a3ace7bb3a51080202eab3ce7c4731
parenteefef56ece7e27c8746cd207e8e2d96996ea5de1
tsan: make mem profile data more consistent

We currently query number of threads before reading /proc/self/smaps.
But reading /proc/self/smaps can take lots of time for huge processes
and it's retries several times with different buffer sizes.
Overall it can take tens of seconds. This can make number of threads
significantly inconsistent with the rest of the stats.
So query it after reading /proc/self/smaps.

Depends on D110149.

Reviewed By: melver, vitalybuka

Differential Revision: https://reviews.llvm.org/D110150
compiler-rt/lib/tsan/rtl/tsan_platform.h
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
compiler-rt/lib/tsan/rtl/tsan_platform_windows.cpp
compiler-rt/lib/tsan/rtl/tsan_rtl.cpp