This is an archive of the discontinued LLVM Phabricator instance.

Support resetting STATISTIC() values using llvm::ResetStatistics()
ClosedPublic

Authored by dsanders on Mar 6 2018, 4:55 PM.

Details

Summary

Most of the time, compiler statistics can be obtained using a process that
performs a single compilation and terminates such as llc. However, this isn't
always the case. JITs for example, perform multiple compilations over their
lifetime and STATISTIC() will record cumulative values across all of them.

Provide tools like this with the facilities needed to measure individual
compilations by allowing them to reset the STATISTIC() values back to zero using
llvm::ResetStatistics(). It's still the tools responsibility to ensure that they
perform compilations in such a way that the results are meaningful to their
intended use.

Diff Detail

Repository
rL LLVM

Event Timeline

dsanders created this revision.Mar 6 2018, 4:55 PM
bogner added inline comments.Mar 7 2018, 11:47 AM
unittests/ADT/StatisticTest.cpp
26 ↗(On Diff #137296)

Isn't S.first a StringRef? Why do we need a std::string here for the comparison?

152–154 ↗(On Diff #137296)

Why bother even calling it if we're not testing anything?

dsanders added inline comments.Mar 7 2018, 11:55 AM
unittests/ADT/StatisticTest.cpp
26 ↗(On Diff #137296)

It was a const char * at one point. I'll fix this.

152–154 ↗(On Diff #137296)

I was on the fence about calling it. I decided to leave it there since it at least confirms that it doesn't crash.

dsanders updated this revision to Diff 137454.Mar 7 2018, 12:06 PM

Remove unnecessary std::string constructor

bogner accepted this revision.Mar 7 2018, 4:52 PM

LGTM

This revision is now accepted and ready to land.Mar 7 2018, 4:52 PM
This revision was automatically updated to reflect the committed changes.