~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to lib/Support/Allocator.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
14
#include "llvm/Support/Allocator.h"
 
15
#include "llvm/Support/raw_ostream.h"
 
16
 
 
17
namespace llvm {
 
18
 
 
19
namespace detail {
 
20
 
 
21
void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
 
22
                                size_t TotalMemory) {
 
23
  errs() << "\nNumber of memory regions: " << NumSlabs << '\n'
 
24
         << "Bytes used: " << BytesAllocated << '\n'
 
25
         << "Bytes allocated: " << TotalMemory << '\n'
 
26
         << "Bytes wasted: " << (TotalMemory - BytesAllocated)
 
27
         << " (includes alignment, etc)\n";
 
28
}
 
29
 
 
30
} // End namespace detail.
 
31
 
 
32
void PrintRecyclerStats(size_t Size,
 
33
                        size_t Align,
 
34
                        size_t FreeListSize) {
 
35
  errs() << "Recycler element size: " << Size << '\n'
 
36
         << "Recycler element alignment: " << Align << '\n'
 
37
         << "Number of elements free for recycling: " << FreeListSize << '\n';
 
38
}
 
39
 
 
40
}