Allocator.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file implements the BumpPtrAllocator interface.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "llvm/Support/Allocator.h"
  14. #include "llvm/Support/raw_ostream.h"
  15. namespace llvm {
  16. namespace detail {
  17. void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
  18. size_t TotalMemory) {
  19. errs() << "\nNumber of memory regions: " << NumSlabs << '\n'
  20. << "Bytes used: " << BytesAllocated << '\n'
  21. << "Bytes allocated: " << TotalMemory << '\n'
  22. << "Bytes wasted: " << (TotalMemory - BytesAllocated)
  23. << " (includes alignment, etc)\n";
  24. }
  25. } // End namespace detail.
  26. void PrintRecyclerStats(size_t Size,
  27. size_t Align,
  28. size_t FreeListSize) {
  29. errs() << "Recycler element size: " << Size << '\n'
  30. << "Recycler element alignment: " << Align << '\n'
  31. << "Number of elements free for recycling: " << FreeListSize << '\n';
  32. }
  33. }