[llvm-commits] [compiler-rt] r170548 - in /compiler-rt/trunk/lib/asan: asan_allocator2.cc asan_stats.h asan_thread_registry.cc
Kostya Serebryany
kcc at google.com
Wed Dec 19 06:56:38 PST 2012
Author: kcc
Date: Wed Dec 19 08:56:38 2012
New Revision: 170548
URL: http://llvm.org/viewvc/llvm-project?rev=170548&view=rev
Log:
[asan] asan_allocator2: add mmap/munmap stats
Modified:
compiler-rt/trunk/lib/asan/asan_allocator2.cc
compiler-rt/trunk/lib/asan/asan_stats.h
compiler-rt/trunk/lib/asan/asan_thread_registry.cc
Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=170548&r1=170547&r2=170548&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Wed Dec 19 08:56:38 2012
@@ -32,9 +32,18 @@
struct AsanMapUnmapCallback {
void OnMap(uptr p, uptr size) const {
PoisonShadow(p, size, kAsanHeapLeftRedzoneMagic);
+ // Statistics.
+ AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
+ thread_stats.mmaps++;
+ thread_stats.mmaped += size;
+ // thread_stats.mmaped_by_size[size_class] += n_chunks;
}
void OnUnmap(uptr p, uptr size) const {
PoisonShadow(p, size, 0);
+ // Statistics.
+ AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
+ thread_stats.munmaps++;
+ thread_stats.munmaped += size;
}
};
@@ -187,6 +196,9 @@
PushList(q);
PopAndDeallocateLoop(ms);
}
+ void SwallowThreadLocalCache(AllocatorCache *cache) {
+ // FIXME.
+ }
void BypassThreadLocalQuarantine(AsanChunk *m) {
SpinMutexLock l(&mutex_);
Push(m);
@@ -420,6 +432,7 @@
void AsanThreadLocalMallocStorage::CommitBack() {
quarantine.SwallowThreadLocalQuarantine(this);
+ quarantine.SwallowThreadLocalCache(GetAllocatorCache(this));
}
SANITIZER_INTERFACE_ATTRIBUTE
Modified: compiler-rt/trunk/lib/asan/asan_stats.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stats.h?rev=170548&r1=170547&r2=170548&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_stats.h (original)
+++ compiler-rt/trunk/lib/asan/asan_stats.h Wed Dec 19 08:56:38 2012
@@ -37,6 +37,8 @@
uptr realloced;
uptr mmaps;
uptr mmaped;
+ uptr munmaps;
+ uptr munmaped;
uptr mmaped_by_size[kNumberOfSizeClasses];
uptr malloced_by_size[kNumberOfSizeClasses];
uptr freed_by_size[kNumberOfSizeClasses];
Modified: compiler-rt/trunk/lib/asan/asan_thread_registry.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread_registry.cc?rev=170548&r1=170547&r2=170548&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread_registry.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread_registry.cc Wed Dec 19 08:56:38 2012
@@ -123,7 +123,7 @@
uptr AsanThreadRegistry::GetHeapSize() {
ScopedLock lock(&mu_);
UpdateAccumulatedStatsUnlocked();
- return accumulated_stats_.mmaped;
+ return accumulated_stats_.mmaped - accumulated_stats_.munmaped;
}
uptr AsanThreadRegistry::GetFreeBytes() {
More information about the llvm-commits
mailing list