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

Side by Side Diff: src/IceGlobalContext.cpp

Issue 1850163003: Subzero. Outputs liveness memory usage. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes make presubmit Created 4 years, 8 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 unified diff | Download patch
« src/IceCfg.h ('K') | « src/IceCfg.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 OstreamLocker _(Ctx); 251 OstreamLocker _(Ctx);
252 Ostream &Str = Ctx->getStrDump(); 252 Ostream &Str = Ctx->getStrDump();
253 const std::string Name = 253 const std::string Name =
254 (Func == nullptr ? "_FINAL_" : Func->getFunctionNameAndSize()); 254 (Func == nullptr ? "_FINAL_" : Func->getFunctionNameAndSize());
255 #define X(str, tag) \ 255 #define X(str, tag) \
256 Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n"; 256 Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n";
257 CODESTATS_TABLE 257 CODESTATS_TABLE
258 #undef X 258 #undef X
259 Str << "|" << Name << "|Spills+Fills|" 259 Str << "|" << Name << "|Spills+Fills|"
260 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n"; 260 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n";
261 Str << "|" << Name << "|Memory Usage|"; 261 Str << "|" << Name << "|Memory Usage |";
262 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed()) 262 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed()) {
263 Str << MemUsed; 263 static constexpr size_t _1MB = 1024 * 1024;
Jim Stichnoth 2016/04/01 15:22:34 So this got me thinking, why were we seeing seeing
John 2016/04/01 18:05:51 Done.
264 else 264 Str << (MemUsed / _1MB) << " MB";
265 } else {
265 Str << "(requires '-track-memory')"; 266 Str << "(requires '-track-memory')";
267 }
266 Str << "\n"; 268 Str << "\n";
267 Str << "|" << Name << "|CPool Sizes "; 269 Str << "|" << Name << "|CPool Sizes ";
268 { 270 {
269 auto Pool = Ctx->getConstPool(); 271 auto Pool = Ctx->getConstPool();
270 Str << "|f32=" << Pool->Floats.size(); 272 Str << "|f32=" << Pool->Floats.size();
271 Str << "|f64=" << Pool->Doubles.size(); 273 Str << "|f64=" << Pool->Doubles.size();
272 Str << "|i1=" << Pool->Integers1.size(); 274 Str << "|i1=" << Pool->Integers1.size();
273 Str << "|i8=" << Pool->Integers8.size(); 275 Str << "|i8=" << Pool->Integers8.size();
274 Str << "|i16=" << Pool->Integers16.size(); 276 Str << "|i16=" << Pool->Integers16.size();
275 Str << "|i32=" << Pool->Integers32.size(); 277 Str << "|i32=" << Pool->Integers32.size();
276 Str << "|i64=" << Pool->Integers64.size(); 278 Str << "|i64=" << Pool->Integers64.size();
277 Str << "|Rel=" << Pool->Relocatables.size(); 279 Str << "|Rel=" << Pool->Relocatables.size();
278 Str << "|ExtRel=" << Pool->ExternRelocatables.size(); 280 Str << "|ExtRel=" << Pool->ExternRelocatables.size();
279 } 281 }
280 Str << "\n"; 282 Str << "\n";
281 if (Func != nullptr) { 283 if (Func != nullptr) {
282 Str << "|" << Name << "|Cfg Memory |" << Func->getTotalMemoryMB() 284 Str << "|" << Name << "|Cfg Memory |" << Func->getTotalMemoryMB()
285 << " MB\n";
286 Str << "|" << Name << "|Liveness Memory |" << Func->getLivenessMemoryMB()
283 << " MB\n"; 287 << " MB\n";
284 } 288 }
285 } 289 }
286 290
287 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, 291 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError,
288 ELFStreamer *ELFStr) 292 ELFStreamer *ELFStr)
289 : Strings(new StringPool()), ConstPool(new ConstantPool()), ErrorStatus(), 293 : Strings(new StringPool()), ConstPool(new ConstantPool()), ErrorStatus(),
290 StrDump(OsDump), StrEmit(OsEmit), StrError(OsError), IntrinsicsInfo(this), 294 StrDump(OsDump), StrEmit(OsEmit), StrError(OsError), IntrinsicsInfo(this),
291 ObjectWriter(), 295 ObjectWriter(),
292 OptQ(/*Sequential=*/Flags.isSequential(), 296 OptQ(/*Sequential=*/Flags.isSequential(),
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 Ctx = Func->getContext(); 1009 Ctx = Func->getContext();
1006 Active = 1010 Active =
1007 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); 1011 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled();
1008 if (Active) 1012 if (Active)
1009 Ctx->pushTimer(ID, StackID); 1013 Ctx->pushTimer(ID, StackID);
1010 } 1014 }
1011 1015
1012 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); 1016 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS);
1013 1017
1014 } // end of namespace Ice 1018 } // end of namespace Ice
OLDNEW
« src/IceCfg.h ('K') | « src/IceCfg.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698