Skip to content

[NFC] Remove -debug-time-compilation #32938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2020

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Jul 17, 2020

This flag no longer does anything now that the unified statistics
reporting infrastructure exists. It is better to use
-driver-time-compilation to see a bird's eye view of timing statistics
for frontend jobs, and -stats-output-dir to see a down-and-dirty view of
everything including performance counters.

While I'm here, remove the SharedTimer infrastructure since it no longer has any real use in the compiler.

CodaFi added 2 commits July 16, 2020 17:35
This flag no longer does anything now that the unified statistics
reporting infrastructure exists. It is better to use
-driver-time-compilation to see a bird's eye view of timing statistics
for frontend jobs, and -stats-output-dir to see a down-and-dirty view of
everything including performance counters.
Teach the UnifiedStatsReporter to directly construct
llvm::NamedRegionTimer for itself.
@CodaFi CodaFi requested a review from davidungar July 17, 2020 00:36
@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 17, 2020

@swift-ci smoke test

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor thoughts, but overall OK.

Comment on lines -562 to -585
- `-Xfrontend -debug-time-compilation`: asks each frontend to print out timers
for each phase of its execution. Its output (per-frontend) looks like this:

```
===-------------------------------------------------------------------------===
Swift compilation
===-------------------------------------------------------------------------===
Total Execution Time: 0.0876 seconds (0.0877 wall clock)

---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0241 ( 53.9%) 0.0394 ( 92.0%) 0.0635 ( 72.5%) 0.0635 ( 72.5%) Import resolution
0.0170 ( 38.0%) 0.0025 ( 5.8%) 0.0195 ( 22.3%) 0.0195 ( 22.2%) Type checking / Semantic analysis
0.0013 ( 3.0%) 0.0004 ( 0.8%) 0.0017 ( 1.9%) 0.0017 ( 1.9%) LLVM output
0.0010 ( 2.3%) 0.0003 ( 0.7%) 0.0013 ( 1.5%) 0.0013 ( 1.5%) SILGen
0.0006 ( 1.4%) 0.0002 ( 0.4%) 0.0008 ( 0.9%) 0.0008 ( 0.9%) IRGen
0.0004 ( 0.8%) 0.0000 ( 0.1%) 0.0004 ( 0.5%) 0.0004 ( 0.5%) SIL optimization
0.0002 ( 0.5%) 0.0001 ( 0.1%) 0.0003 ( 0.3%) 0.0003 ( 0.3%) LLVM optimization
0.0001 ( 0.1%) 0.0000 ( 0.1%) 0.0001 ( 0.1%) 0.0001 ( 0.1%) Parsing
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) SIL verification (pre-optimization)
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) SIL verification (post-optimization)
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) AST verification
0.0448 (100.0%) 0.0428 (100.0%) 0.0876 (100.0%) 0.0877 (100.0%) Total
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that what was nice about this was that it was an easy way to get per-frontend-per-phase info. How would you do that now? I'm sorry to see it go, but I think there are no RecursionSafeTimers in the compiler anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to use the full -stats-dir output.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a loss, but not your fault, since the flag doesn't work anymore.

@@ -146,9 +145,8 @@ auxName(StringRef ModuleName,
}

class UnifiedStatsReporter::RecursionSafeTimers {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any of these left in the compiler? If not, were they replaced by something else? A quick search of the code seems to say there are none. Is NamedRegionTimer already recursion-safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  // First make a note in the recursion-safe timers; these
  // are active anytime UnifiedStatsReporter is active.
  if (IsEntry) {
    RecursiveTimers->beginTimer(T.EventName);
  } else {
    RecursiveTimers->endTimer(T.EventName);
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to see usages because of the Optional::emplace here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but I was looking for the individual uses in the code, like: checkTypes() { RecursiveTimer rt; .... }

@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 17, 2020

@CodaFi CodaFi merged commit 954fc46 into swiftlang:master Jul 17, 2020
@CodaFi CodaFi deleted the time-is-of-the-essence branch July 17, 2020 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants