Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ void AnalysisConsumer::HandleCode(Decl *D, AnalysisMode Mode,
++NumFunctionsAnalyzedSyntaxOnly;
if (SyntaxCheckTimer) {
SyntaxCheckTimer->stopTimer();
llvm::TimeRecord CheckerEndTime = SyntaxCheckTimer->getTotalTime();
CheckerEndTime -= CheckerStartTime;
DisplayTime(CheckerEndTime);
llvm::TimeRecord CheckerDuration =
SyntaxCheckTimer->getTotalTime() - CheckerStartTime;
DisplayTime(CheckerDuration);
if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
AnalyzerTimers->clear();
}
Expand Down Expand Up @@ -804,11 +804,11 @@ void AnalysisConsumer::RunPathSensitiveChecks(Decl *D,
Mgr->options.MaxNodesPerTopLevelFunction);
if (ExprEngineTimer) {
ExprEngineTimer->stopTimer();
llvm::TimeRecord ExprEngineEndTime = ExprEngineTimer->getTotalTime();
ExprEngineEndTime -= ExprEngineStartTime;
llvm::TimeRecord ExprEngineDuration =
ExprEngineTimer->getTotalTime() - ExprEngineStartTime;
PathRunningTime.set(static_cast<unsigned>(
std::lround(ExprEngineEndTime.getWallTime() * 1000)));
DisplayTime(ExprEngineEndTime);
std::lround(ExprEngineDuration.getWallTime() * 1000)));
DisplayTime(ExprEngineDuration);
if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
AnalyzerTimers->clear();
}
Expand Down
5 changes: 5 additions & 0 deletions llvm/include/llvm/Support/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class TimeRecord {
MemUsed -= RHS.MemUsed;
InstructionsExecuted -= RHS.InstructionsExecuted;
}
TimeRecord operator-(const TimeRecord &RHS) const {
TimeRecord R = *this;
R -= RHS;
return R;
}

/// Print the current time record to \p OS, with a breakdown showing
/// contributions to the \p Total time record.
Expand Down