mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Stats] Warn on failure-to-write stats / trace files.
This commit is contained in:
@@ -361,8 +361,11 @@ UnifiedStatsReporter::~UnifiedStatsReporter()
|
||||
|
||||
std::error_code EC;
|
||||
raw_fd_ostream ostream(StatsFilename, EC, fs::F_Append | fs::F_Text);
|
||||
if (EC)
|
||||
if (EC) {
|
||||
llvm::errs() << "Error opening -stats-output-dir file '"
|
||||
<< TraceFilename << "' for writing\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// We change behavior here depending on whether -DLLVM_ENABLE_STATS and/or
|
||||
// assertions were on in this build; this is somewhat subtle, but turning on
|
||||
@@ -387,8 +390,11 @@ UnifiedStatsReporter::~UnifiedStatsReporter()
|
||||
if (LastTracedFrontendCounters && SourceMgr) {
|
||||
std::error_code EC;
|
||||
raw_fd_ostream tstream(TraceFilename, EC, fs::F_Append | fs::F_Text);
|
||||
if (EC)
|
||||
if (EC) {
|
||||
llvm::errs() << "Error opening -trace-stats-events file '"
|
||||
<< TraceFilename << "' for writing\n";
|
||||
return;
|
||||
}
|
||||
tstream << "Time,Live,IsEntry,EventName,CounterName,"
|
||||
<< "CounterDelta,CounterValue,SourceRange\n";
|
||||
for (auto const &E : FrontendStatsEvents) {
|
||||
|
||||
@@ -23,10 +23,14 @@
|
||||
// RUN: %FileCheck -input-file %t/driver.csv %s
|
||||
// RUN: %utils/process-stats-dir.py --compare-to-csv-baseline %t/driver.csv %t
|
||||
|
||||
// RUN: %target-swiftc_driver -c -o %t/out.o -stats-output-dir %t/this/is/not/a/directory %s 2>&1 | %FileCheck -check-prefix=CHECK-NODIR %s
|
||||
|
||||
// CHECK: {{"AST.NumSourceLines" [1-9][0-9]*$}}
|
||||
// CHECK: {{"IRModule.NumIRFunctions" [1-9][0-9]*$}}
|
||||
// CHECK: {{"LLVM.NumLLVMBytesOutput" [1-9][0-9]*$}}
|
||||
|
||||
// CHECK-NODIR: {{Error opening -stats-output-dir file}}
|
||||
|
||||
public func foo() {
|
||||
print("hello")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user