LLVM  9.0.0svn
Allocator.cpp
Go to the documentation of this file.
1 //===--- Allocator.cpp - Simple memory allocation abstraction -------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the BumpPtrAllocator interface.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/Support/Allocator.h"
15 
16 namespace llvm {
17 
18 namespace detail {
19 
20 void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated,
21  size_t TotalMemory) {
22  errs() << "\nNumber of memory regions: " << NumSlabs << '\n'
23  << "Bytes used: " << BytesAllocated << '\n'
24  << "Bytes allocated: " << TotalMemory << '\n'
25  << "Bytes wasted: " << (TotalMemory - BytesAllocated)
26  << " (includes alignment, etc)\n";
27 }
28 
29 } // End namespace detail.
30 
32  size_t Align,
33  size_t FreeListSize) {
34  errs() << "Recycler element size: " << Size << '\n'
35  << "Recycler element alignment: " << Align << '\n'
36  << "Number of elements free for recycling: " << FreeListSize << '\n';
37 }
38 
39 }
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize)
PrintRecyclingAllocatorStats - Helper for RecyclingAllocator for printing statistics.
Definition: Allocator.cpp:31
void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, size_t TotalMemory)
Definition: Allocator.cpp:20
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
uint32_t Size
Definition: Profile.cpp:46