diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-01-05 22:17:53 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-01-05 22:17:53 +0000 |
commit | c6611cdb3718b02ce1a4346939cbb0f4094385b2 (patch) | |
tree | 05fb3da6c60077d6ddf7502639ac3583af36318f /lib/sanitizer_common/sanitizer_quarantine.h | |
parent | 3b10b7bd2b4039370f677ab87f10a1c7f7d2df57 (diff) |
Improved ASAN allocator and quarantine stats.
Summary: Improved ASAN allocator and quarantine stats.
Reviewers: eugenis
Patch by Alex Shlyapnikov.
Subscribers: llvm-commits, kubabrecka
Differential Revision: https://reviews.llvm.org/D28333
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_quarantine.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_quarantine.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_quarantine.h b/lib/sanitizer_common/sanitizer_quarantine.h index ff8f3fa30..3d74ef2b6 100644 --- a/lib/sanitizer_common/sanitizer_quarantine.h +++ b/lib/sanitizer_common/sanitizer_quarantine.h @@ -73,6 +73,11 @@ class Quarantine { Recycle(cb); } + void PrintStats() const { + // It assumes that the world is stopped, just as the allocator's PrintStats. + cache_.PrintStats(); + } + private: // Read-only data. char pad0_[kCacheLineSize]; @@ -163,8 +168,25 @@ class QuarantineCache { return b; } + void PrintStats() const { + uptr batch_count = 0; + uptr total_quarantine_bytes = 0; + uptr total_quarantine_chunks = 0; + for (List::ConstIterator it = list_.begin(); it != list_.end(); ++it) { + batch_count++; + total_quarantine_bytes += (*it).size; + total_quarantine_chunks += (*it).count; + } + Printf("Global quarantine stats: batches: %zd; bytes: %zd; chunks: %zd " + "(capacity: %zd chunks)\n", + batch_count, total_quarantine_bytes, total_quarantine_chunks, + batch_count * QuarantineBatch::kSize); + } + private: - IntrusiveList<QuarantineBatch> list_; + typedef IntrusiveList<QuarantineBatch> List; + + List list_; atomic_uintptr_t size_; void SizeAdd(uptr add) { |