diff options
author | Dan Gohman <gohman@apple.com> | 2010-06-18 15:56:31 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-06-18 15:56:31 +0000 |
commit | 03c3dc7b6828d48a9f3be50896b3390a696caa64 (patch) | |
tree | fd34a907e926493b458a8d905ab6048dcbc4ad95 /include/llvm/Support/Timer.h | |
parent | 27445f0375ae01652c08569c7843bddc95cedd61 (diff) | |
download | llvm-03c3dc7b6828d48a9f3be50896b3390a696caa64.tar.gz llvm-03c3dc7b6828d48a9f3be50896b3390a696caa64.tar.bz2 llvm-03c3dc7b6828d48a9f3be50896b3390a696caa64.tar.xz |
Give NamedRegionTimer an Enabled flag, allowing all its clients to
switch from this:
if (TimePassesIsEnabled) {
NamedRegionTimer T(Name, GroupName);
do_something();
} else {
do_something(); // duplicate the code, this time without a timer!
}
to this:
{
NamedRegionTimer T(Name, GroupName, TimePassesIsEnabled);
do_something();
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/Timer.h')
-rw-r--r-- | include/llvm/Support/Timer.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h index 00dfeaa4fa..f959136f86 100644 --- a/include/llvm/Support/Timer.h +++ b/include/llvm/Support/Timer.h @@ -150,8 +150,10 @@ public: /// is primarily used for debugging and for hunting performance problems. /// struct NamedRegionTimer : public TimeRegion { - explicit NamedRegionTimer(StringRef Name); - explicit NamedRegionTimer(StringRef Name, StringRef GroupName); + explicit NamedRegionTimer(StringRef Name, + bool Enabled = true); + explicit NamedRegionTimer(StringRef Name, StringRef GroupName, + bool Enabled = true); }; |