Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions clang/test/Misc/time-passes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// RUN: -ftime-report %s -o /dev/null 2>&1 | \
// RUN: FileCheck %s --check-prefixes=TIME,NPM
// RUN: %clang_cc1 -emit-obj -O1 \
// RUN: -ftime-report %s -o /dev/null \
// RUN: -mllvm -info-output-file=%t
// RUN: cat %t | FileCheck %s --check-prefixes=TIME,NPM
// RUN: %clang_cc1 -emit-obj -O1 \
// RUN: -ftime-report=per-pass %s -o /dev/null 2>&1 | \
// RUN: FileCheck %s --check-prefixes=TIME,NPM
// RUN: %clang_cc1 -emit-obj -O1 \
Expand All @@ -11,6 +15,10 @@
// RUN: %clang_cc1 -emit-obj -O1 \
// RUN: -ftime-report-json %s -o /dev/null 2>&1 | \
// RUN: FileCheck %s --check-prefixes=JSON
// RUN: %clang_cc1 -emit-obj -O1 \
// RUN: -ftime-report-json %s -o /dev/null \
// RUN: -mllvm -info-output-file=%t
// RUN: cat %t | FileCheck %s --check-prefixes=JSON

// TIME: Pass execution timing report
// TIME: Total Execution Time:
Expand Down
9 changes: 5 additions & 4 deletions clang/tools/driver/cc1_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,13 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {

// If any timers were active but haven't been destroyed yet, print their
// results now. This happens in -disable-free mode.
std::unique_ptr<raw_ostream> IOFile = llvm::CreateInfoOutputFile();
if (Clang->getCodeGenOpts().TimePassesJson) {
llvm::errs() << "{\n";
llvm::TimerGroup::printAllJSONValues(llvm::errs(), "");
llvm::errs() << "\n}\n";
*IOFile << "{\n";
llvm::TimerGroup::printAllJSONValues(*IOFile, "");
*IOFile << "\n}\n";
} else {
llvm::TimerGroup::printAll(llvm::errs());
llvm::TimerGroup::printAll(*IOFile);
}
llvm::TimerGroup::clearAll();

Expand Down
Loading