2006-10-29 22:08:03 +00:00
|
|
|
//===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-10-29 22:08:03 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the BumpPtrAllocator interface.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Support/Allocator.h"
|
2009-07-24 04:01:01 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2006-10-29 22:08:03 +00:00
|
|
|
|
2009-07-23 18:34:13 +00:00
|
|
|
namespace llvm {
|
2009-07-23 00:30:41 +00:00
|
|
|
|
2014-04-14 06:42:56 +00:00
|
|
|
namespace detail {
|
|
|
|
|
2014-04-14 03:55:11 +00:00
|
|
|
void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
|
|
|
|
size_t TotalMemory) {
|
2009-07-24 04:01:01 +00:00
|
|
|
errs() << "\nNumber of memory regions: " << NumSlabs << '\n'
|
|
|
|
<< "Bytes used: " << BytesAllocated << '\n'
|
|
|
|
<< "Bytes allocated: " << TotalMemory << '\n'
|
|
|
|
<< "Bytes wasted: " << (TotalMemory - BytesAllocated)
|
|
|
|
<< " (includes alignment, etc)\n";
|
2009-07-23 18:34:13 +00:00
|
|
|
}
|
|
|
|
|
2014-04-14 06:42:56 +00:00
|
|
|
} // End namespace detail.
|
|
|
|
|
2009-07-23 18:34:13 +00:00
|
|
|
void PrintRecyclerStats(size_t Size,
|
|
|
|
size_t Align,
|
|
|
|
size_t FreeListSize) {
|
2009-07-24 04:01:01 +00:00
|
|
|
errs() << "Recycler element size: " << Size << '\n'
|
|
|
|
<< "Recycler element alignment: " << Align << '\n'
|
|
|
|
<< "Number of elements free for recycling: " << FreeListSize << '\n';
|
2006-10-29 22:08:03 +00:00
|
|
|
}
|
2008-07-07 22:58:06 +00:00
|
|
|
|
2015-06-23 09:49:53 +00:00
|
|
|
}
|