LLVM: include/llvm/Support/DebugCounter.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42#ifndef LLVM_SUPPORT_DEBUGCOUNTER_H

43#define LLVM_SUPPORT_DEBUGCOUNTER_H

44

51#include

52

53namespace llvm {

54

56

58public:

65

66

69

70

71

72 bool Active = false;

73

74

75 bool IsSet = false;

76

77 int64_t Count = 0;

82

83 public:

87 };

88

90

91

92

94

95

97

98

100

101

102

103

104

105

110

112 if (!Counter.Active)

113 return true;

115 }

116

117

118

119

121

126

127

129 return {Info.Count, Info.CurrChunkIdx};

130 }

131

132

134 Info.Count = State.Count;

135 Info.CurrChunkIdx = State.ChunkIdx;

136 }

137

138#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

139

141#endif

142

144

145

146

150

151

153

154

156 return {Info->Name, Info->Desc};

157 }

158

159

166

168 for (auto &[_, Counter] : Counters)

169 Counter->Active = true;

170 }

171

172protected:

175

177

179

181

183};

184

185#define DEBUG_COUNTER(VARNAME, COUNTERNAME, DESC) \

186 static DebugCounter::CounterInfo VARNAME(COUNTERNAME, DESC)

187

188}

189#endif

Analysis containing CSE Info

#define LLVM_DUMP_METHOD

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

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),...

Struct to store counter info.

Definition DebugCounter.h:67

CounterInfo(StringRef Name, StringRef Desc)

Definition DebugCounter.h:84

friend class DebugCounter

Definition DebugCounter.h:68

Definition DebugCounter.h:57

CounterInfo * getCounterInfo(StringRef Name) const

Definition DebugCounter.h:147

static CounterState getCounterState(CounterInfo &Info)

Definition DebugCounter.h:128

static void setCounterState(CounterInfo &Info, CounterState State)

Definition DebugCounter.h:133

static LLVM_ABI void printChunks(raw_ostream &OS, ArrayRef< Chunk >)

MapVector< StringRef, CounterInfo * >::const_iterator end() const

Definition DebugCounter.h:163

bool ShouldPrintCounterQueries

Definition DebugCounter.h:180

void addCounter(CounterInfo *Info)

Definition DebugCounter.h:173

static void registerCounter(CounterInfo *Info)

Definition DebugCounter.h:106

bool handleCounterIncrement(CounterInfo &Info)

bool BreakOnLast

Definition DebugCounter.h:182

std::pair< StringRef, StringRef > getCounterDesc(CounterInfo *Info) const

Definition DebugCounter.h:155

MapVector< StringRef, CounterInfo * >::const_iterator begin() const

Definition DebugCounter.h:160

LLVM_ABI void push_back(const std::string &)

bool ShouldPrintCounter

Definition DebugCounter.h:178

void activateAllCounters()

Definition DebugCounter.h:167

static bool shouldExecute(CounterInfo &Counter)

Definition DebugCounter.h:111

static bool isCounterSet(CounterInfo &Info)

Definition DebugCounter.h:120

static LLVM_ABI bool parseChunks(StringRef Str, SmallVector< Chunk > &Res)

Return true on parsing error and print the error message on the llvm::errs()

static LLVM_ABI bool shouldExecuteImpl(CounterInfo &Counter)

static LLVM_ABI DebugCounter & instance()

Returns a reference to the singleton instance.

LLVM_ABI void print(raw_ostream &OS) const

LLVM_DUMP_METHOD void dump() const

MapVector< StringRef, CounterInfo * > Counters

Definition DebugCounter.h:176

unsigned int getNumCounters() const

Definition DebugCounter.h:152

This class implements a map that also provides access to all stored values in a deterministic order.

typename VectorType::const_iterator const_iterator

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

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

This class implements an extremely fast bulk output stream that can only output to a stream.

This is an optimization pass for GlobalISel generic memory operations.

Definition DebugCounter.h:59

bool contains(int64_t Idx) const

Definition DebugCounter.h:63

int64_t End

Definition DebugCounter.h:61

int64_t Begin

Definition DebugCounter.h:60

LLVM_ABI void print(llvm::raw_ostream &OS)

Definition DebugCounter.h:122

int64_t Count

Definition DebugCounter.h:123

uint64_t ChunkIdx

Definition DebugCounter.h:124