[cfe-commits] r110247 - in /cfe/trunk: include/clang/Frontend/PCHReader.h lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Wed Aug 4 14:22:45 PDT 2010
Author: cornedbee
Date: Wed Aug 4 16:22:45 2010
New Revision: 110247
URL: http://llvm.org/viewvc/llvm-project?rev=110247&view=rev
Log:
Bring stats for the method pool back.
Modified:
cfe/trunk/include/clang/Frontend/PCHReader.h
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Frontend/PCHWriter.cpp
Modified: cfe/trunk/include/clang/Frontend/PCHReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHReader.h?rev=110247&r1=110246&r2=110247&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHReader.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHReader.h Wed Aug 4 16:22:45 2010
@@ -459,15 +459,21 @@
/// \brief The number of macros de-serialized from the PCH file.
unsigned NumMacrosRead;
+ /// \brief The total number of macros stored in the PCH file.
+ unsigned TotalNumMacros;
+
/// \brief The number of selectors that have been read.
unsigned NumSelectorsRead;
- /// \brief The number of times we have looked into the selector table
- /// and not found anything.
- unsigned NumSelectorMisses;
+ /// \brief The number of method pool entries that have been read.
+ unsigned NumMethodPoolEntriesRead;
- /// \brief The total number of macros stored in the PCH file.
- unsigned TotalNumMacros;
+ /// \brief The number of times we have looked up a selector in the method
+ /// pool and not found anything interesting.
+ unsigned NumMethodPoolMisses;
+
+ /// \brief The total number of method pool entries in the selector table.
+ unsigned TotalNumMethodPoolEntries;
/// Number of lexical decl contexts read/total.
unsigned NumLexicalDeclContextsRead, TotalLexicalDeclContexts;
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=110247&r1=110246&r2=110247&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Aug 4 16:22:45 2010
@@ -421,8 +421,9 @@
Consumer(0), isysroot(isysroot), DisableValidation(DisableValidation),
NumStatHits(0), NumStatMisses(0), NumSLocEntriesRead(0),
TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0),
- NumMacrosRead(0), NumSelectorsRead(0), NumSelectorMisses(0),
- TotalNumMacros(0), NumLexicalDeclContextsRead(0),
+ NumMacrosRead(0), TotalNumMacros(0), NumSelectorsRead(0),
+ NumMethodPoolEntriesRead(0), NumMethodPoolMisses(0),
+ TotalNumMethodPoolEntries(0), NumLexicalDeclContextsRead(0),
TotalLexicalDeclContexts(0), NumVisibleDeclContextsRead(0),
TotalVisibleDeclContexts(0), NumCurrentElementsDeserializing(0) {
RelocatablePCH = false;
@@ -436,7 +437,8 @@
isysroot(isysroot), DisableValidation(DisableValidation), NumStatHits(0),
NumStatMisses(0), NumSLocEntriesRead(0), TotalNumSLocEntries(0),
NumStatementsRead(0), TotalNumStatements(0), NumMacrosRead(0),
- NumSelectorsRead(0), NumSelectorMisses(0), TotalNumMacros(0),
+ TotalNumMacros(0), NumSelectorsRead(0), NumMethodPoolEntriesRead(0),
+ NumMethodPoolMisses(0), TotalNumMethodPoolEntries(0),
NumLexicalDeclContextsRead(0), TotalLexicalDeclContexts(0),
NumVisibleDeclContextsRead(0), TotalVisibleDeclContexts(0),
NumCurrentElementsDeserializing(0) {
@@ -1662,6 +1664,7 @@
F.SelectorLookupTableData + Record[0],
F.SelectorLookupTableData,
PCHSelectorLookupTrait(*this));
+ TotalNumMethodPoolEntries += Record[1];
break;
case pch::REFERENCED_SELECTOR_POOL: {
@@ -3092,15 +3095,13 @@
NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
((float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
* 100));
-#if 0
- if (TotalSelectorsInSelector) {
+ if (TotalNumMethodPoolEntries) {
std::fprintf(stderr, " %u/%u method pool entries read (%f%%)\n",
- NumSelectorSelectorsRead, TotalSelectorsInSelector,
- ((float)NumSelectorSelectorsRead/TotalSelectorsInSelector
+ NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
+ ((float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
* 100));
- std::fprintf(stderr, " %u method pool misses\n", NumSelectorMisses);
+ std::fprintf(stderr, " %u method pool misses\n", NumMethodPoolMisses);
}
-#endif
std::fprintf(stderr, "\n");
}
@@ -3222,6 +3223,10 @@
PCHSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
if (Pos != PoolTable->end()) {
++NumSelectorsRead;
+ // FIXME: Not quite happy with the statistics here. We probably should
+ // disable this tracking when called via LoadSelector.
+ // Also, should entries without methods count as misses?
+ ++NumMethodPoolEntriesRead;
PCHSelectorLookupTrait::data_type Data = *Pos;
if (DeserializationListener)
DeserializationListener->SelectorRead(Data.ID, Sel);
@@ -3229,7 +3234,7 @@
}
}
- ++NumSelectorMisses;
+ ++NumMethodPoolMisses;
return std::pair<ObjCMethodList, ObjCMethodList>();
}
Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=110247&r1=110246&r2=110247&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Wed Aug 4 16:22:45 2010
@@ -1694,9 +1694,11 @@
}
if (!changed)
continue;
+ } else if (Data.Instance.Method || Data.Factory.Method) {
+ // A new method pool entry.
+ ++NumTableEntries;
}
Generator.insert(S, Data);
- ++NumTableEntries;
}
// Create the on-disk hash table in a buffer.
More information about the cfe-commits
mailing list