r339024 - [AST] Add individual size info for Types in -print-stats

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 6 08:17:33 PDT 2018


Author: brunoricci
Date: Mon Aug  6 08:17:32 2018
New Revision: 339024

URL: http://llvm.org/viewvc/llvm-project?rev=339024&view=rev
Log:
[AST] Add individual size info for Types in -print-stats

This mirrors what is done for Decls and Stmts in the -print-stats
output, ie instead of printing "57426 LValueReference types"
we print "57426 LValueReference types, 40 each (2297040 bytes)".


Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=339024&r1=339023&r2=339024&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Aug  6 08:17:32 2018
@@ -885,7 +885,9 @@ void ASTContext::PrintStats() const {
 #define TYPE(Name, Parent)                                              \
   if (counts[Idx])                                                      \
     llvm::errs() << "    " << counts[Idx] << " " << #Name               \
-                 << " types\n";                                         \
+                 << " types, " << sizeof(Name##Type) << " each "        \
+                 << "(" << counts[Idx] * sizeof(Name##Type)             \
+                 << " bytes)\n";                                        \
   TotalBytes += counts[Idx] * sizeof(Name##Type);                       \
   ++Idx;
 #define ABSTRACT_TYPE(Name, Parent)




More information about the cfe-commits mailing list