LLVM: include/llvm/ProfileData/InstrProfWriter.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_PROFILEDATA_INSTRPROFWRITER_H

15#define LLVM_PROFILEDATA_INSTRPROFWRITER_H

16

28#include

29#include

30#include

31

32namespace llvm {

33

34

39

41public:

43

44private:

45 bool Sparse;

47

48 uint64_t MaxTemporalProfTraceLength;

49

50 uint64_t TemporalProfTraceReservoirSize;

51

52 uint64_t TemporalProfTraceStreamSize = 0;

53

55 std::mt19937 RNG;

56

57

59

60

61 std::vectorllvm::object::BuildID BinaryIds;

62

63

65

66

68

70

71

72

73

74

75

76 bool WritePrevVersion = false;

77

78

80

81

82 bool MemProfFullSchema;

83

84

85 bool MemprofGenerateRandomHotness;

86

87 std::unique_ptrmemprof::DataAccessProfData DataAccessProfileData;

88

89

90

92

93public:

94

95

96

97

99 uint64_t TemporalProfTraceReservoirSize = 0,

100 uint64_t MaxTemporalProfTraceLength = 0,

101 bool WritePrevVersion = false,

105 bool MemProfFullSchema = false,

106 bool MemprofGenerateRandomHotness = false,

107 unsigned MemprofGenerateRandomHotnessSeed = 0);

109

111

112

113

114

121

122

123

127

128

131

132

134

136 std::unique_ptrmemprof::DataAccessProfData DataAccessProfile);

137

138

141

142

144

145

147

148

150

151

154

156

157

162

163

165

166

167

169

170

172 ProfileKind = Other;

174 }

175

176

178 return (static_cast<bool>(ProfileKind & A) &&

179 static_cast<bool>(Other & B)) ||

180 (static_cast<bool>(ProfileKind & B) &&

181 static_cast<bool>(Other & A));

182 };

183

184

185

186 if (static_cast<bool>(

190 }

197 "cannot merge FunctionEntryOnly profiles and BB profiles together");

198 }

199

200

201 ProfileKind |= Other;

203 }

204

206

210

211

215 MemProfVersionRequested = Version;

216 }

218

219

224

225private:

229

230

233

234

235

238

239

240

244

246

247

248

249

251 const bool WritePrevVersion, ProfOStream &OS);

252

253

255

256

258};

259

260}

261

262#endif

This file defines the StringMap class.

This file declares a library for handling Build IDs and using them to find debug info.

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

This file defines the DenseMap class.

This file implements a map that provides insertion order iteration.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

uint64_t GUID

Declare a type to represent a global unique identifier for a global value.

A symbol table used for function [IR]PGO name look-up with keys (such as pointers,...

Definition InstrProfWriter.h:40

bool hasSingleByteCoverage() const

Definition InstrProfWriter.h:207

LLVM_ABI InstrProfWriter(bool Sparse=false, uint64_t TemporalProfTraceReservoirSize=0, uint64_t MaxTemporalProfTraceLength=0, bool WritePrevVersion=false, memprof::IndexedVersion MemProfVersionRequested=static_cast< memprof::IndexedVersion >(memprof::MinimumSupportedVersion), bool MemProfFullSchema=false, bool MemprofGenerateRandomHotness=false, unsigned MemprofGenerateRandomHotnessSeed=0)

void addVTableName(StringRef VTableName)

Definition InstrProfWriter.h:120

LLVM_ABI Error write(raw_fd_ostream &OS)

Write the profile to OS.

LLVM_ABI void addTemporalProfileTraces(SmallVectorImpl< TemporalProfTraceTy > &SrcTraces, uint64_t SrcStreamSize)

Add SrcTraces using reservoir sampling where SrcStreamSize is the total number of temporal profiling ...

LLVM_ABI void overlapRecord(NamedInstrProfRecord &&Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, const OverlapFuncFilters &FuncFilter)

LLVM_ABI Error writeText(raw_fd_ostream &OS)

Write the profile in text format to OS.

InstrProfKind getProfileKind() const

Definition InstrProfWriter.h:205

void addRecord(NamedInstrProfRecord &&I, function_ref< void(Error)> Warn)

Definition InstrProfWriter.h:117

LLVM_ABI void addBinaryIds(ArrayRef< llvm::object::BuildID > BIs)

void setMemProfVersionRequested(memprof::IndexedVersion Version)

Definition InstrProfWriter.h:214

static LLVM_ABI void writeRecordInText(StringRef Name, uint64_t Hash, const InstrProfRecord &Counters, InstrProfSymtab &Symtab, raw_fd_ostream &OS)

Write Record in text format to OS.

LLVM_ABI void setValueProfDataEndianness(llvm::endianness Endianness)

LLVM_ABI void addRecord(NamedInstrProfRecord &&I, uint64_t Weight, function_ref< void(Error)> Warn)

Add function counts for the given function.

LLVM_ABI ~InstrProfWriter()

LLVM_ABI void mergeRecordsFromWriter(InstrProfWriter &&IPW, function_ref< void(Error)> Warn)

Merge existing function counts from the given writer.

Error mergeProfileKind(const InstrProfKind Other)

Update the attributes of the current profile from the attributes specified.

Definition InstrProfWriter.h:168

LLVM_ABI void writeTextTemporalProfTraceData(raw_fd_ostream &OS, InstrProfSymtab &Symtab)

Write temporal profile trace data to the header in text format to OS.

SmallDenseMap< uint64_t, InstrProfRecord > ProfilingData

Definition InstrProfWriter.h:42

LLVM_ABI std::unique_ptr< MemoryBuffer > writeBuffer()

Write the profile, returning the raw data. For testing.

LLVM_ABI void setOutputSparse(bool Sparse)

StringMap< ProfilingData > & getProfileData()

Definition InstrProfWriter.h:110

LLVM_ABI bool addMemProfData(memprof::IndexedMemProfData Incoming, function_ref< void(Error)> Warn)

Add the entire MemProfData Incoming to the writer context.

LLVM_ABI void addDataAccessProfData(std::unique_ptr< memprof::DataAccessProfData > DataAccessProfile)

void setMemProfFullSchema(bool Full)

Definition InstrProfWriter.h:217

LLVM_ABI Error validateRecord(const InstrProfRecord &Func)

This interface provides simple read-only access to a block of memory, and provides simple methods for...

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

StringRef - Represent a constant reference to a string, i.e.

StringSet - A wrapper for StringMap that provides set-like functionality.

An efficient, type-erasing, non-owning reference to a callable.

A raw_ostream that writes to a file descriptor.

A raw_ostream that writes to an std::string.

constexpr uint64_t MinimumSupportedVersion

This is an optimization pass for GlobalISel generic memory operations.

FunctionAddr VTableAddr uintptr_t uintptr_t Version

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

InstrProfKind

An enum describing the attributes of an instrumented profile.

@ LoopEntriesInstrumentation

@ FunctionEntryInstrumentation

@ FrontendInstrumentation

Incoming for lane maks phi as machine instruction, incoming register Reg and incoming block Block are...

Profiling information for a single function.