Support resetting STATISTIC() values using llvm::ResetStatistics()
authorDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 8 Mar 2018 02:36:25 +0000 (02:36 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 8 Mar 2018 02:36:25 +0000 (02:36 +0000)
commit1087a542554ac0ab23bbca07d026b2fb49862809
treee930be6193658e4dfbcfb9d91aabaa66799d1fbb
parente4f47b4c63dd99508410087f5b6643f3e668ed23
Support resetting STATISTIC() values using llvm::ResetStatistics()

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.

Reviewers: qcolombet, rtereshin, bogner, aditya_nandakumar

Reviewed By: bogner

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D44181

llvm-svn: 326981
llvm/include/llvm/ADT/Statistic.h
llvm/lib/Support/Statistic.cpp
llvm/unittests/ADT/StatisticTest.cpp