Skip to content

Commit 3fffe68

Browse files
committed
[Serialization] Add -ftime-trace block for reading loaded modules.
The existing ReadAST block only describes the top-level PCM file being loaded, when in practice most of the time taken is dealing with other PCM files which are loaded in turn. Because this work isn't strictly recursive (first all the modules are discovered, then processsed in several flat loops), we can't have a neat recursive structure like processing of source files. Instead, slap a timer on the largest of these boxes: reading the AST block for modules. In practice this shows where most of the time goes, and in particular which modules are most expensive.
1 parent 4002eaa commit 3fffe68

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/lib/Serialization/ASTReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,6 +4295,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName,
42954295
// hit errors parsing the ASTs at this point.
42964296
for (ImportedModule &M : Loaded) {
42974297
ModuleFile &F = *M.Mod;
4298+
llvm::TimeTraceScope Scope2("Read Loaded AST", F.ModuleName);
42984299

42994300
// Read the AST block.
43004301
if (llvm::Error Err = ReadASTBlock(F, ClientLoadCapabilities)) {

0 commit comments

Comments
 (0)