Go to the documentation of this file.
53 "Enable statistics output from program (available with Asserts)"),
56 "stats-json",
cl::desc(
"Display statistics as json data"),
67 std::vector<TrackingStatistic *>
Stats;
76 using const_iterator = std::vector<TrackingStatistic *>::const_iterator;
83 const_iterator
begin()
const {
return Stats.begin(); }
84 const_iterator
end()
const {
return Stats.end(); }
107 if (!
Initialized.load(std::memory_order_relaxed)) {
115 SI.addStatistic(
this);
118 Initialized.store(
true, std::memory_order_release);
122 StatisticInfo::StatisticInfo() {
128 StatisticInfo::~StatisticInfo() {
143 if (
int Cmp = std::strcmp(
LHS->getDebugType(),
RHS->getDebugType()))
149 return std::strcmp(
LHS->getDesc(),
RHS->getDesc()) < 0;
153 void StatisticInfo::reset() {
160 for (
auto *Stat :
Stats) {
163 Stat->Initialized =
false;
179 unsigned MaxDebugTypeLen = 0, MaxValLen = 0;
181 MaxValLen =
std::max(MaxValLen, (
unsigned)utostr(Stat->getValue()).size());
183 std::max(MaxDebugTypeLen, (
unsigned)std::strlen(Stat->getDebugType()));
189 OS <<
"===" << std::string(73,
'-') <<
"===\n"
190 <<
" ... Statistics Collected ...\n"
191 <<
"===" << std::string(73,
'-') <<
"===\n\n";
195 OS <<
format(
"%*" PRIu64
" %-*s - %s\n", MaxValLen, Stat->getValue(),
196 MaxDebugTypeLen, Stat->getDebugType(), Stat->getDesc());
210 const char *delim =
"";
214 "Statistic group/type name is simple.");
216 "Statistic name is simple");
217 OS <<
"\t\"" << Stat->getDebugType() <<
'.' << Stat->getName() <<
"\": "
229 #if LLVM_ENABLE_STATS
234 if (
Stats.Stats.empty())
return;
250 (*OutStream) <<
"Statistics are disabled. "
251 <<
"Build with asserts or with -DLLVM_FORCE_ENABLE_STATS\n";
258 std::vector<std::pair<StringRef, uint64_t>> ReturnStats;
260 for (
const auto &Stat :
StatInfo->statistics())
261 ReturnStats.emplace_back(Stat->getName(), Stat->getValue());
const std::vector< std::pair< StringRef, uint64_t > > GetStatistics()
Get the statistics.
This is an optimization pass for GlobalISel generic memory operations.
static const char * printAllJSONValues(raw_ostream &OS, const char *delim)
Prints all timers as JSON key/value pairs.
LocationClass< Ty > location(Ty &L)
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
std::unique_ptr< raw_fd_ostream > CreateInfoOutputFile()
Return a file stream to print our output on.
bool AreStatisticsEnabled()
Check if statistics are enabled.
void RegisterStatistic()
RegisterStatistic - The first time a statistic is bumped, this method is called.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
This class implements an extremely fast bulk output stream that can only output to a stream.
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
static ManagedStatic< StatisticInfo > StatInfo
static void ConstructTimerLists()
Ensure global timer group lists are initialized.
void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
static bool EnableStats
-stats - Command line option to cause transformations to emit stats about what they did.
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
void EnableStatistics(bool DoPrintOnExit=true)
Enable the collection and printing of statistics.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StandardInstrumentations SI(Debug, VerifyEach)
void PrintStatistics()
Print statistics to the file returned by CreateInfoOutputFile().
static ManagedStatic< sys::SmartMutex< true > > StatLock
if(llvm_vc STREQUAL "") set(fake_version_inc "$
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
StringRef getName() const
Return a constant reference to the value's name.
std::atomic< bool > Initialized
void ResetStatistics()
Reset the statistics.
void stable_sort(R &&Range)
block placement Basic Block Placement Stats
void sort(IteratorTy Start, IteratorTy End)
void initStatisticOptions()
A range adaptor for a pair of iterators.