forked from OSchip/llvm-project
Add some more ASTReader statistics for global method pool lookups.
llvm-svn: 173702
This commit is contained in:
parent
cccbdbf0db
commit
ad2f7a59a1
|
@ -549,7 +549,7 @@ private:
|
||||||
GlobalSelectorMapType;
|
GlobalSelectorMapType;
|
||||||
|
|
||||||
/// \brief Mapping from global selector IDs to the module in which the
|
/// \brief Mapping from global selector IDs to the module in which the
|
||||||
/// selector resides along with the offset that should be added to the
|
|
||||||
/// global selector ID to produce a local ID.
|
/// global selector ID to produce a local ID.
|
||||||
GlobalSelectorMapType GlobalSelectorMap;
|
GlobalSelectorMapType GlobalSelectorMap;
|
||||||
|
|
||||||
|
@ -752,8 +752,20 @@ private:
|
||||||
unsigned NumMethodPoolEntriesRead;
|
unsigned NumMethodPoolEntriesRead;
|
||||||
|
|
||||||
/// \brief The number of times we have looked up a selector in the method
|
/// \brief The number of times we have looked up a selector in the method
|
||||||
/// pool and not found anything interesting.
|
/// pool.
|
||||||
unsigned NumMethodPoolMisses;
|
unsigned NumMethodPoolLookups;
|
||||||
|
|
||||||
|
/// \brief The number of times we have looked up a selector in the method
|
||||||
|
/// pool and found something.
|
||||||
|
unsigned NumMethodPoolHits;
|
||||||
|
|
||||||
|
/// \brief The number of times we have looked up a selector in the method
|
||||||
|
/// pool within a specific module.
|
||||||
|
unsigned NumMethodPoolTableLookups;
|
||||||
|
|
||||||
|
/// \brief The number of times we have looked up a selector in the method
|
||||||
|
/// pool within a specific module and found something.
|
||||||
|
unsigned NumMethodPoolTableHits;
|
||||||
|
|
||||||
/// \brief The total number of method pool entries in the selector table.
|
/// \brief The total number of method pool entries in the selector table.
|
||||||
unsigned TotalNumMethodPoolEntries;
|
unsigned TotalNumMethodPoolEntries;
|
||||||
|
|
|
@ -5655,8 +5655,19 @@ void ASTReader::PrintStats() {
|
||||||
NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
|
NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
|
||||||
((float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
|
((float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
|
||||||
* 100));
|
* 100));
|
||||||
std::fprintf(stderr, " %u method pool misses\n", NumMethodPoolMisses);
|
|
||||||
}
|
}
|
||||||
|
if (NumMethodPoolLookups) {
|
||||||
|
std::fprintf(stderr, " %u/%u method pool lookups succeeded (%f%%)\n",
|
||||||
|
NumMethodPoolHits, NumMethodPoolLookups,
|
||||||
|
((float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
|
||||||
|
}
|
||||||
|
if (NumMethodPoolTableLookups) {
|
||||||
|
std::fprintf(stderr, " %u/%u method pool table lookups succeeded (%f%%)\n",
|
||||||
|
NumMethodPoolTableHits, NumMethodPoolTableLookups,
|
||||||
|
((float)NumMethodPoolTableHits/NumMethodPoolTableLookups
|
||||||
|
* 100.0));
|
||||||
|
}
|
||||||
|
|
||||||
if (NumIdentifierLookupHits) {
|
if (NumIdentifierLookupHits) {
|
||||||
std::fprintf(stderr,
|
std::fprintf(stderr,
|
||||||
" %u / %u identifier table lookups succeeded (%f%%)\n",
|
" %u / %u identifier table lookups succeeded (%f%%)\n",
|
||||||
|
@ -5872,12 +5883,14 @@ namespace clang { namespace serialization {
|
||||||
if (M.Generation <= This->PriorGeneration)
|
if (M.Generation <= This->PriorGeneration)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
++This->Reader.NumMethodPoolTableLookups;
|
||||||
ASTSelectorLookupTable *PoolTable
|
ASTSelectorLookupTable *PoolTable
|
||||||
= (ASTSelectorLookupTable*)M.SelectorLookupTable;
|
= (ASTSelectorLookupTable*)M.SelectorLookupTable;
|
||||||
ASTSelectorLookupTable::iterator Pos = PoolTable->find(This->Sel);
|
ASTSelectorLookupTable::iterator Pos = PoolTable->find(This->Sel);
|
||||||
if (Pos == PoolTable->end())
|
if (Pos == PoolTable->end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
++This->Reader.NumMethodPoolTableHits;
|
||||||
++This->Reader.NumSelectorsRead;
|
++This->Reader.NumSelectorsRead;
|
||||||
// FIXME: Not quite happy with the statistics here. We probably should
|
// FIXME: Not quite happy with the statistics here. We probably should
|
||||||
// disable this tracking when called via LoadSelector.
|
// disable this tracking when called via LoadSelector.
|
||||||
|
@ -5920,14 +5933,15 @@ void ASTReader::ReadMethodPool(Selector Sel) {
|
||||||
Generation = CurrentGeneration;
|
Generation = CurrentGeneration;
|
||||||
|
|
||||||
// Search for methods defined with this selector.
|
// Search for methods defined with this selector.
|
||||||
|
++NumMethodPoolLookups;
|
||||||
ReadMethodPoolVisitor Visitor(*this, Sel, PriorGeneration);
|
ReadMethodPoolVisitor Visitor(*this, Sel, PriorGeneration);
|
||||||
ModuleMgr.visit(&ReadMethodPoolVisitor::visit, &Visitor);
|
ModuleMgr.visit(&ReadMethodPoolVisitor::visit, &Visitor);
|
||||||
|
|
||||||
if (Visitor.getInstanceMethods().empty() &&
|
if (Visitor.getInstanceMethods().empty() &&
|
||||||
Visitor.getFactoryMethods().empty()) {
|
Visitor.getFactoryMethods().empty())
|
||||||
++NumMethodPoolMisses;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
++NumMethodPoolHits;
|
||||||
|
|
||||||
if (!getSema())
|
if (!getSema())
|
||||||
return;
|
return;
|
||||||
|
@ -7038,7 +7052,9 @@ ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context,
|
||||||
NumStatementsRead(0), TotalNumStatements(0), NumMacrosRead(0),
|
NumStatementsRead(0), TotalNumStatements(0), NumMacrosRead(0),
|
||||||
TotalNumMacros(0), NumIdentifierLookups(0), NumIdentifierLookupHits(0),
|
TotalNumMacros(0), NumIdentifierLookups(0), NumIdentifierLookupHits(0),
|
||||||
NumSelectorsRead(0), NumMethodPoolEntriesRead(0),
|
NumSelectorsRead(0), NumMethodPoolEntriesRead(0),
|
||||||
NumMethodPoolMisses(0), TotalNumMethodPoolEntries(0),
|
NumMethodPoolLookups(0), NumMethodPoolHits(0),
|
||||||
|
NumMethodPoolTableLookups(0), NumMethodPoolTableHits(0),
|
||||||
|
TotalNumMethodPoolEntries(0),
|
||||||
NumLexicalDeclContextsRead(0), TotalLexicalDeclContexts(0),
|
NumLexicalDeclContextsRead(0), TotalLexicalDeclContexts(0),
|
||||||
NumVisibleDeclContextsRead(0), TotalVisibleDeclContexts(0),
|
NumVisibleDeclContextsRead(0), TotalVisibleDeclContexts(0),
|
||||||
TotalModulesSizeInBits(0), NumCurrentElementsDeserializing(0),
|
TotalModulesSizeInBits(0), NumCurrentElementsDeserializing(0),
|
||||||
|
|
Loading…
Reference in New Issue