Debian Codegraph @

suite/synctools/tablegen/include/llvm/ProfileData/RawMemProfReader.h

raw symbols SCIP
1 #ifndef LLVM_PROFILEDATA_RAWMEMPROFREADER_H_
2 #define LLVM_PROFILEDATA_RAWMEMPROFREADER_H_
3 //===- MemProfReader.h - Instrumented memory profiling reader ---*- C++ -*-===//
4 //
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //
9 //===----------------------------------------------------------------------===//
10 //
11 // This file contains support for reading MemProf profiling data.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "llvm/Support/Error.h"
16 #include "llvm/Support/MemoryBuffer.h"
17
18 namespace llvm {
19 namespace memprof {
20
21 class RawMemProfReader {
22 public:
23 RawMemProfReader(std::unique_ptr<MemoryBuffer> DataBuffer)
24 : DataBuffer(std::move(DataBuffer)) {}
25 // Prints aggregate counts for each raw profile parsed from the DataBuffer.
26 void printSummaries(raw_ostream &OS) const;
27
28 // Return true if the \p DataBuffer starts with magic bytes indicating it is
29 // a raw binary memprof profile.
30 static bool hasFormat(const MemoryBuffer &DataBuffer);
31
32 // Create a RawMemProfReader after sanity checking the contents of the file at
33 // \p Path.
34 static Expected<std::unique_ptr<RawMemProfReader>> create(const Twine &Path);
35
36 private:
37 std::unique_ptr<MemoryBuffer> DataBuffer;
38 };
39
40 } // namespace memprof
41 } // namespace llvm
42
43 #endif // LLVM_PROFILEDATA_RAWMEMPROFREADER_H_