mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Stats] Add NumSourceLines{,PerSecond} counters.
This commit is contained in:
@@ -432,7 +432,8 @@ static bool emitIndexData(SourceFile *PrimarySourceFile,
|
||||
static void countStatsPostSema(UnifiedStatsReporter &Stats,
|
||||
CompilerInstance& Instance) {
|
||||
auto &C = Stats.getFrontendCounters();
|
||||
C.NumSourceBuffers = Instance.getSourceMgr().getLLVMSourceMgr().getNumBuffers();
|
||||
auto &SM = Instance.getSourceMgr();
|
||||
C.NumSourceBuffers = SM.getLLVMSourceMgr().getNumBuffers();
|
||||
C.NumLinkLibraries = Instance.getLinkLibraries().size();
|
||||
|
||||
auto const &AST = Instance.getASTContext();
|
||||
@@ -459,6 +460,12 @@ static void countStatsPostSema(UnifiedStatsReporter &Stats,
|
||||
C.NumPrefixOperators = SF->PrefixOperators.size();
|
||||
C.NumPrecedenceGroups = SF->PrecedenceGroups.size();
|
||||
C.NumUsedConformances = SF->getUsedConformances().size();
|
||||
|
||||
auto bufID = SF->getBufferID();
|
||||
if (bufID.hasValue()) {
|
||||
C.NumSourceLines =
|
||||
SM.getEntireTextForBuffer(bufID.getValue()).count('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user