freebsd-dev/lib/Support/Allocator.cpp

41 lines
1.3 KiB
C++
Raw Normal View History

2009-06-02 17:52:33 +00:00
//===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the BumpPtrAllocator interface.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/Allocator.h"
2009-10-14 17:57:32 +00:00
#include "llvm/Support/raw_ostream.h"
2009-06-02 17:52:33 +00:00
2009-10-14 17:57:32 +00:00
namespace llvm {
2009-06-02 17:52:33 +00:00
namespace detail {
2009-10-14 17:57:32 +00:00
void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
size_t TotalMemory) {
2009-10-14 17:57:32 +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";
}
} // End namespace detail.
2009-10-14 17:57:32 +00:00
void PrintRecyclerStats(size_t Size,
size_t Align,
size_t FreeListSize) {
errs() << "Recycler element size: " << Size << '\n'
<< "Recycler element alignment: " << Align << '\n'
<< "Number of elements free for recycling: " << FreeListSize << '\n';
2009-06-02 17:52:33 +00:00
}
} // namespace llvm