ProfileData: Avoid double underscores in header guards
[oota-llvm.git] / include / llvm / ProfileData / InstrProfWriter.h
1 //=-- InstrProfWriter.h - Instrumented profiling writer -----------*- C++ -*-=//
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 contains support for writing profiling data for instrumentation
11 // based PGO and coverage.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_PROFILEDATA_INSTRPROF_WRITER_H_
16 #define LLVM_PROFILEDATA_INSTRPROF_WRITER_H_
17
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/ProfileData/InstrProf.h"
21 #include "llvm/Support/DataTypes.h"
22 #include "llvm/Support/raw_ostream.h"
23
24 #include <vector>
25
26 namespace llvm {
27
28 /// Writer for instrumentation based profile data.
29 class InstrProfWriter {
30 public:
31   struct CounterData {
32     uint64_t Hash;
33     std::vector<uint64_t> Counts;
34   };
35 private:
36   StringMap<CounterData> FunctionData;
37 public:
38   /// Add function counts for the given function. If there are already counts
39   /// for this function and the hash and number of counts match, each counter is
40   /// summed.
41   error_code addFunctionCounts(StringRef FunctionName, uint64_t FunctionHash,
42                                ArrayRef<uint64_t> Counters);
43   /// Ensure that all data is written to disk.
44   void write(raw_ostream &OS);
45 };
46
47 } // end namespace llvm
48
49 #endif // LLVM_PROFILE_INSTRPROF_WRITER_H_