Remove -Ztimings=info

The text-based timing information emits many additional lines, creating
quite a bit of verbosity. Remove in favor of the HTML report, as
suggested at
https://github.com/rust-lang/cargo/pull/10245#issuecomment-1003741052 .

If we re-add text-based timing information in the future, it could come
in the form of a text-based report, or as a duration printed on the same
line as the crate it measures rather than a separate line.
This commit is contained in:
Josh Triplett 2022-01-14 14:50:28 -08:00
parent b2496f0590
commit 86bb4a0c2b
4 changed files with 3 additions and 28 deletions

View file

@ -21,8 +21,6 @@ pub struct Timings<'cfg> {
enabled: bool,
/// If true, saves an HTML report to disk.
report_html: bool,
/// If true, reports unit completion to stderr.
report_info: bool,
/// If true, emits JSON information with timing information.
report_json: bool,
/// When Cargo started.
@ -102,9 +100,8 @@ impl<'cfg> Timings<'cfg> {
.map_or(false, |t| t.iter().any(|opt| opt == what))
};
let report_html = has_report("html");
let report_info = has_report("info");
let report_json = has_report("json");
let enabled = report_html | report_info | report_json;
let enabled = report_html | report_json;
let mut root_map: HashMap<PackageId, Vec<String>> = HashMap::new();
for unit in root_units {
@ -139,7 +136,6 @@ impl<'cfg> Timings<'cfg> {
config: bcx.config,
enabled,
report_html,
report_info,
report_json,
start: bcx.config.creation_time(),
start_str,
@ -227,18 +223,6 @@ impl<'cfg> Timings<'cfg> {
unit_time
.unlocked_units
.extend(unlocked.iter().cloned().cloned());
if self.report_info {
let msg = format!(
"{}{} in {:.1}s",
unit_time.name_ver(),
unit_time.target,
unit_time.duration
);
let _ = self
.config
.shell()
.status_with_color("Completed", msg, termcolor::Color::Cyan);
}
if self.report_json {
let msg = machine_message::TimingInfo {
package_id: unit_time.unit.pkg.package_id(),

View file

@ -770,7 +770,7 @@ impl CliUnstable {
fn parse_timings(value: Option<&str>) -> Vec<String> {
match value {
None => vec!["html".to_string(), "info".to_string()],
None => vec!["html".to_string()],
Some(v) => v.split(',').map(|s| s.to_string()).collect(),
}
}

View file

@ -419,11 +419,9 @@ following values:
- `html` — Saves a file called `cargo-timing.html` to the current directory
with a report of the compilation. Files are also saved with a timestamp in
the filename if you want to look at older runs.
- `info` — Displays a message to stdout after each compilation finishes with
how long it took.
- `json` — Emits some JSON information about timing information.
The default if none are specified is `html,info`.
The default if none are specified is `html`.
#### Reading the graphs

View file

@ -34,13 +34,6 @@ fn timings_works() {
[DOWNLOADED] dep v0.1.0 [..]
[COMPILING] dep v0.1.0
[COMPILING] foo v0.1.0 [..]
[COMPLETED] dep v0.1.0 in [..]s
[COMPLETED] foo v0.1.0 in [..]s
[COMPLETED] foo v0.1.0 bin \"foo\" in [..]s
[COMPLETED] foo v0.1.0 example \"ex1\" in [..]s
[COMPLETED] foo v0.1.0 lib (test) in [..]s
[COMPLETED] foo v0.1.0 bin \"foo\" (test) in [..]s
[COMPLETED] foo v0.1.0 test \"t1\" (test) in [..]s
[FINISHED] [..]
Timing report saved to [..]/foo/cargo-timing-[..].html
",