Skip to content

Commit 954fc46

Browse files
authored
Merge pull request #32938 from CodaFi/time-is-of-the-essence
[NFC] Remove -debug-time-compilation
2 parents 930c8f2 + 6389774 commit 954fc46

File tree

17 files changed

+5
-139
lines changed

17 files changed

+5
-139
lines changed

docs/CompilerPerformance.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -559,30 +559,6 @@ compilers on hand while you're working.
559559
0.0001 (100.0%) 0.0001 (100.0%) 0.0001 (100.0%) 0.0490 (100.0%) Total
560560
```
561561
562-
- `-Xfrontend -debug-time-compilation`: asks each frontend to print out timers
563-
for each phase of its execution. Its output (per-frontend) looks like this:
564-
565-
```
566-
===-------------------------------------------------------------------------===
567-
Swift compilation
568-
===-------------------------------------------------------------------------===
569-
Total Execution Time: 0.0876 seconds (0.0877 wall clock)
570-
571-
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
572-
0.0241 ( 53.9%) 0.0394 ( 92.0%) 0.0635 ( 72.5%) 0.0635 ( 72.5%) Import resolution
573-
0.0170 ( 38.0%) 0.0025 ( 5.8%) 0.0195 ( 22.3%) 0.0195 ( 22.2%) Type checking / Semantic analysis
574-
0.0013 ( 3.0%) 0.0004 ( 0.8%) 0.0017 ( 1.9%) 0.0017 ( 1.9%) LLVM output
575-
0.0010 ( 2.3%) 0.0003 ( 0.7%) 0.0013 ( 1.5%) 0.0013 ( 1.5%) SILGen
576-
0.0006 ( 1.4%) 0.0002 ( 0.4%) 0.0008 ( 0.9%) 0.0008 ( 0.9%) IRGen
577-
0.0004 ( 0.8%) 0.0000 ( 0.1%) 0.0004 ( 0.5%) 0.0004 ( 0.5%) SIL optimization
578-
0.0002 ( 0.5%) 0.0001 ( 0.1%) 0.0003 ( 0.3%) 0.0003 ( 0.3%) LLVM optimization
579-
0.0001 ( 0.1%) 0.0000 ( 0.1%) 0.0001 ( 0.1%) 0.0001 ( 0.1%) Parsing
580-
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) SIL verification (pre-optimization)
581-
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) SIL verification (post-optimization)
582-
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) AST verification
583-
0.0448 (100.0%) 0.0428 (100.0%) 0.0876 (100.0%) 0.0877 (100.0%) Total
584-
```
585-
586562
- `-Xfrontend -debug-time-function-bodies`: asks each frontend to print out
587563
the time spent typechecking _every function_ in the program, sorted by time
588564
taken. The output is therefore voluminous, but can help when reducing a
@@ -1053,10 +1029,8 @@ getting slower between versions:
10531029
parameter of the script). Reconfirm that _just those two isolated frontend
10541030
processes_ still show the regression you're interested in isolating.
10551031
1056-
6. Check high-level diagnostic output between the two compilers, either the
1057-
newer unified stats reporter (`-stats-output-dir`) or the older flags
1058-
(`-Xfrontend -debug-time-compilation` and friends). Comparing the two will
1059-
often guide the search.
1032+
6. Check the value of performance counters between the two compilers via the
1033+
unified stats reporter (`-stats-output-dir`).
10601034
10611035
7. Run both frontend processes under a profiler and compare the profiles in
10621036
detail. At this point there ought to be _some_ sign of a difference, either

include/swift/Basic/Statistic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
#include "llvm/ADT/SmallString.h"
1717
#include "llvm/ADT/Statistic.h"
18+
#include "llvm/Support/Timer.h"
1819
#include "swift/Basic/LLVM.h"
19-
#include "swift/Basic/Timer.h"
2020

2121
#include <thread>
2222
#include <tuple>

include/swift/Basic/Timer.h

Lines changed: 0 additions & 66 deletions
This file was deleted.

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ class FrontendOptions {
161161
/// If set, dumps wall time taken to check each expression.
162162
bool DebugTimeExpressionTypeChecking = false;
163163

164-
/// If set, prints the time taken in each major compilation phase to
165-
/// llvm::errs().
166-
///
167-
/// \sa swift::SharedTimer
168-
bool DebugTimeCompilation = false;
169-
170164
/// The path to which we should output statistics files.
171165
std::string StatsOutputDir;
172166

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ def build_request_dependency_graph : Flag<["-"], "build-request-dependency-graph
259259
def output_request_graphviz : Separate<["-"], "output-request-graphviz">,
260260
HelpText<"Emit GraphViz output visualizing the request dependency graph">;
261261

262-
def debug_time_compilation : Flag<["-"], "debug-time-compilation">,
263-
HelpText<"Prints the time taken by each compilation phase">;
264262
def debug_time_function_bodies : Flag<["-"], "debug-time-function-bodies">,
265263
HelpText<"Dumps the time it takes to type-check each function body">;
266264
def debug_time_expression_type_checking : Flag<["-"], "debug-time-expression-type-checking">,

lib/Basic/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ add_swift_host_library(swiftBasic STATIC
6262
StringExtras.cpp
6363
TaskQueue.cpp
6464
ThreadSafeRefCounted.cpp
65-
Timer.cpp
6665
Unicode.cpp
6766
UUID.cpp
6867
Version.cpp

lib/Basic/Statistic.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "clang/Basic/SourceLocation.h"
1515
#include "clang/Basic/SourceManager.h"
1616
#include "swift/Basic/Statistic.h"
17-
#include "swift/Basic/Timer.h"
1817
#include "swift/AST/Decl.h"
1918
#include "swift/AST/Expr.h"
2019
#include "llvm/ADT/DenseMap.h"
@@ -146,9 +145,8 @@ auxName(StringRef ModuleName,
146145
}
147146

148147
class UnifiedStatsReporter::RecursionSafeTimers {
149-
150148
struct RecursionSafeTimer {
151-
llvm::Optional<SharedTimer> Timer;
149+
llvm::Optional<llvm::NamedRegionTimer> Timer;
152150
size_t RecursionDepth;
153151
};
154152

@@ -159,7 +157,7 @@ class UnifiedStatsReporter::RecursionSafeTimers {
159157
void beginTimer(StringRef Name) {
160158
RecursionSafeTimer &T = Timers[Name];
161159
if (T.RecursionDepth == 0) {
162-
T.Timer.emplace(Name);
160+
T.Timer.emplace(Name, Name, "swift", "Swift compilation");
163161
}
164162
++T.RecursionDepth;
165163
}
@@ -354,7 +352,6 @@ UnifiedStatsReporter::UnifiedStatsReporter(StringRef ProgramName,
354352
path::append(TraceFilename, makeTraceFileName(ProgramName, AuxName));
355353
path::append(ProfileDirname, makeProfileDirName(ProgramName, AuxName));
356354
EnableStatistics(/*PrintOnExit=*/false);
357-
SharedTimer::enableCompilationTimers();
358355
if (TraceEvents || ProfileEvents || ProfileEntities)
359356
LastTracedFrontendCounters.emplace();
360357
if (TraceEvents)

lib/Basic/Timer.cpp

Lines changed: 0 additions & 17 deletions
This file was deleted.

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ void ArgsToFrontendOptionsConverter::computePrintStatsOptions() {
234234

235235
void ArgsToFrontendOptionsConverter::computeDebugTimeOptions() {
236236
using namespace options;
237-
Opts.DebugTimeCompilation |= Args.hasArg(OPT_debug_time_compilation);
238-
239237
if (const Arg *A = Args.getLastArg(OPT_stats_output_dir)) {
240238
Opts.StatsOutputDir = A->getValue();
241239
if (Args.getLastArg(OPT_trace_stats_events)) {

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "swift/Basic/PrettyStackTrace.h"
4646
#include "swift/Basic/SourceManager.h"
4747
#include "swift/Basic/Statistic.h"
48-
#include "swift/Basic/Timer.h"
4948
#include "swift/Basic/UUID.h"
5049
#include "swift/Frontend/DiagnosticVerifier.h"
5150
#include "swift/Frontend/Frontend.h"
@@ -2232,9 +2231,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
22322231
PDC.setFormattingStyle(
22332232
Invocation.getDiagnosticOptions().PrintedFormattingStyle);
22342233

2235-
if (Invocation.getFrontendOptions().DebugTimeCompilation)
2236-
SharedTimer::enableCompilationTimers();
2237-
22382234
if (Invocation.getFrontendOptions().PrintStats) {
22392235
llvm::EnableStatistics();
22402236
}

lib/IRGen/IRGen.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "swift/Basic/Dwarf.h"
2727
#include "swift/Basic/Platform.h"
2828
#include "swift/Basic/Statistic.h"
29-
#include "swift/Basic/Timer.h"
3029
#include "swift/Basic/Version.h"
3130
#include "swift/ClangImporter/ClangImporter.h"
3231
#include "swift/ClangImporter/ClangModule.h"

lib/Parse/Parser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "swift/AST/SourceFile.h"
2525
#include "swift/Basic/Defer.h"
2626
#include "swift/Basic/SourceManager.h"
27-
#include "swift/Basic/Timer.h"
2827
#include "swift/Parse/Lexer.h"
2928
#include "swift/Parse/CodeCompletionCallbacks.h"
3029
#include "swift/Parse/ParseSILSupport.h"

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "swift/AST/SourceFile.h"
2222
#include "swift/AST/TypeCheckRequests.h"
2323
#include "swift/Basic/Defer.h"
24-
#include "swift/Basic/Timer.h"
2524
#include "swift/Demangling/Demangle.h"
2625
#include "swift/Parse/Lexer.h"
2726
#include "swift/Parse/ParseSILSupport.h"

lib/SILGen/SILGen.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "swift/AST/SourceFile.h"
3030
#include "swift/AST/TypeCheckRequests.h"
3131
#include "swift/Basic/Statistic.h"
32-
#include "swift/Basic/Timer.h"
3332
#include "swift/ClangImporter/ClangModule.h"
3433
#include "swift/SIL/PrettyStackTrace.h"
3534
#include "swift/SIL/SILArgument.h"

lib/Sema/TypeCheckCodeCompletion.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "swift/AST/TypeCheckRequests.h"
4040
#include "swift/Basic/Statistic.h"
4141
#include "swift/Basic/STLExtras.h"
42-
#include "swift/Basic/Timer.h"
4342
#include "swift/Parse/Lexer.h"
4443
#include "swift/Sema/IDETypeChecking.h"
4544
#include "swift/Strings.h"

lib/Sema/TypeChecker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "swift/AST/TypeCheckRequests.h"
3939
#include "swift/Basic/Statistic.h"
4040
#include "swift/Basic/STLExtras.h"
41-
#include "swift/Basic/Timer.h"
4241
#include "swift/Parse/Lexer.h"
4342
#include "swift/Sema/IDETypeChecking.h"
4443
#include "swift/Strings.h"

lib/Serialization/Serialization.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "swift/Basic/Dwarf.h"
4040
#include "swift/Basic/FileSystem.h"
4141
#include "swift/Basic/STLExtras.h"
42-
#include "swift/Basic/Timer.h"
4342
#include "swift/Basic/Version.h"
4443
#include "swift/ClangImporter/ClangImporter.h"
4544
#include "swift/ClangImporter/ClangModule.h"

0 commit comments

Comments
 (0)