Closed
Description
Summary
A -Ztime-passes-json
(likely bikeshed on naming, relatedly -Zsave-analysis-api
has been accepted) would produce:
{
"phase name": {
"rss": 100,
"time": 0.2312,
}
...
}
Motivation
This would help (internal) tooling such as perf.rlo, since it avoids re-parsing rustc's output into proper data structures.
Implementation details
While the compiler could output each pass separately, this may be difficult to implement in practice (since it would require partial JSON serialization, something neither rustc-serialize or Serde support currently, as far as I know).
Alternatives
- Changes to the formatting of
-Ztime-passes
may make it easier to parse.- Removing seemingly arbitrary indentation (at least from my perspective).
- Some other changes? I have not interacted with the parsing code [yet]...
- Would an alternate "switch" that makes all output from the compiler buffer into JSON (similar to the error system) be preferable?
Unresolved Questions
- How should users find the start/end of JSON amid other output?
- Both when using Cargo and rustc directly.
- How should sub-pass timings be reflected? (Likely depends what is currently done).
@nrc seems to be generally in favor, from short discussion on IRC.