-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Stats tracer timer work #14695
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
Stats tracer timer work #14695
Conversation
@swift-ci please test |
return; | ||
const ProtocolConformance *C = | ||
static_cast<const ProtocolConformance *>(Entity); | ||
OS << "<conformance "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conformances already have a printName
method that probably covers this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fixed.
static_cast<const ProtocolConformance *>(Entity); | ||
if (auto const *DC = C->getDeclContext()) { | ||
if (auto const *D = DC->getAsDeclOrDeclExtensionContext()) | ||
D->getSourceRange().print(OS, *SM, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you want the range here, just the location. (Arguably if you have a NormalProtocolConformance you could get an even better location, which is where the conformance is written. But not all conformances are NormalProtocolConformances.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I know the method is named traceLoc but so far I've been actually tracing all of the ranges. Maybe I should rename it? Or maybe ranges are overkill?
(Will use the normalProtocolConformance decl site when available, in any case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be reasonable for some of the other things, but for conformances you'll end up using the entire range of the extension or decl that declares conformance, or maybe just the class that inherits from a conforming decl. That doesn't seem useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok (I think I initially went with ranges because of exprs, but shrug it's pretty much just a hint for the reader anyway).
|
||
public: | ||
|
||
void BeginTimer(StringRef Name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: lowercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, llvm-Caps-ism got the better of me.
continuing in #14703 |
This is a bit of a grab bag of cleanup work in the timers-and-stats-tracers subsystem.
FrontendStatsTracer
(to just a single RAII decl).RecursiveSharedTimer
type with a dynamic map of recursion-preventingSharedTimer
s built fromFrontendStatsTracer
names, active iff theUnifiedStatsReporter
is active (i.e. when the user passes-stats-output-dir
, regardless of full tracing).SharedTimer
s that were confusing users in-debug-time-compilation
withFrontendStatsTracer
s.ProtocolConformance
s (as Doug requested).Decl
s by using theirDescriptiveKindName
.If you can detect a theme here, it's to try to consolidate tracing and timing infrastructure: unless you are doing something special, just drop a FrontendStatsTracer in your code and you'll get recursion-safe timers when we're just collecting time (via -stats-output-dir) and full tracing when we're doing that (via -trace-stats-events).
I'll also be following up shortly with a thing that builds flamegraph-format stacked profiles from the tracers.