Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: src/IceCfg.cpp

Issue 1850163003: Subzero. Outputs liveness memory usage. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index b42f32645305491f665e38cb774f8311d1421cbc..1965fe2d5a82fffac65a1ac22d46cb640a10c774 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -1086,12 +1086,19 @@ void Cfg::emitIAS() {
emitJumpTables();
}
-size_t Cfg::getTotalMemoryMB() {
- constexpr size_t OneMB = 1024 * 1024;
- using ArbitraryType = int;
- // CfgLocalAllocator draws from the same memory pool regardless of allocated
- // object type, so pick an arbitrary type for the template parameter.
- return CfgLocalAllocator<ArbitraryType>().current()->getTotalMemory() / OneMB;
+size_t Cfg::getTotalMemoryMB() const {
+ constexpr size_t _1MB = 1024 * 1024;
+ assert(Allocator != nullptr);
+ assert(CfgAllocatorTraits::current() == Allocator.get());
+ return Allocator->getTotalMemory() / _1MB;
+}
+
+size_t Cfg::getLivenessMemoryMB() const {
+ constexpr size_t _1MB = 1024 * 1024;
+ if (Live == nullptr) {
+ return 0;
+ }
+ return Live->getAllocator()->getTotalMemory() / _1MB;
}
// Dumps the IR with an optional introductory message.
« no previous file with comments | « src/IceCfg.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698