Skip to content

JSON version of -Ztime-passes #36233

Closed
Closed
@Mark-Simulacrum

Description

@Mark-Simulacrum

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions