llvm.org GIT mirror llvm / 5d86759
Add MemoryBuffer::getBufferKind() to report whether a memory buffer uses malloc'ed or mmap'ed memory. This is for performance analysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130432 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 9 years ago
2 changed file(s) with 23 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
118118 static error_code getFileOrSTDIN(const char *Filename,
119119 OwningPtr &result,
120120 int64_t FileSize = -1);
121
122
123 //===--------------------------------------------------------------------===//
124 // Provided for performance analysis.
125 //===--------------------------------------------------------------------===//
126
127 /// The kind of memory backing used to support the MemoryBuffer.
128 enum BufferKind {
129 MemoryBuffer_Malloc,
130 MemoryBuffer_MMap
131 };
132
133 /// Return information on the memory mechanism used to support the
134 /// MemoryBuffer.
135 virtual BufferKind getBufferKind() const = 0;
121136 };
122137
123138 } // end namespace llvm
8585 // The name is stored after the class itself.
8686 return reinterpret_cast(this + 1);
8787 }
88
89 virtual BufferKind getBufferKind() const {
90 return MemoryBuffer_Malloc;
91 }
8892 };
8993 }
9094
190194 sys::Path::UnMapFilePages(reinterpret_cast(RealStart),
191195 RealSize);
192196 }
197
198 virtual BufferKind getBufferKind() const {
199 return MemoryBuffer_MMap;
200 }
193201 };
194202 }
195203