Subzero: Print memory usage info when dumping.
Adds "-verbose mem" to enable printing the amount of CfgLocalAllocator memory allocated, each time Cfg::dump() is called.
"-verbose mem,status" is a good way to get summary info.
BUG= none
R=kschimpf@google.com
Review URL: https://codereview.chromium.org/1743043002 .
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 480893a..5c51ae6 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -203,8 +203,10 @@
FunctionTimer.reset(new TimerMarker(
getContext()->getTimerID(GlobalContext::TSK_Funcs, Name),
getContext(), GlobalContext::TSK_Funcs));
- if (isVerbose(IceV_Status))
- getContext()->getStrDump() << ">>>Translating " << Name << "\n";
+ if (isVerbose(IceV_Status)) {
+ getContext()->getStrDump() << ">>>Translating "
+ << getFunctionNameAndSize() << "\n";
+ }
}
TimerMarker T(TimerStack::TT_translate, this);
@@ -1084,6 +1086,12 @@
Ostream &Str = Ctx->getStrDump();
if (!Message.empty())
Str << "================ " << Message << " ================\n";
+ if (isVerbose(IceV_Mem)) {
+ constexpr size_t OneMB = 1024 * 1024;
+ Str << "Memory size = "
+ << (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB)
+ << " MB\n";
+ }
setCurrentNode(getEntryNode());
// Print function name+args
if (isVerbose(IceV_Instructions)) {