Skip to content
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

Print out a report of times. #446

Closed
Ben-PH opened this issue Aug 13, 2020 · 3 comments
Closed

Print out a report of times. #446

Ben-PH opened this issue Aug 13, 2020 · 3 comments
Assignees
Milestone

Comments

@Ben-PH
Copy link

Ben-PH commented Aug 13, 2020

Features Description
The outputs of the commands being run are independent of the overall build script. As a result, the extra commands (such as running time cargo make $TASK) or tasks are required to get information on the the build script as a whole. This feature would provide an option that would have something like the following printed at the end.

=== Time Stats ===
Total: xm y.yys
TaskA: 40% (xm y.yys)
TaskC: 23% (xm y.yys)
TaskE: 9%  (xm y.yys)
Others: 28% (xm y.yys, 4 tasks omitted)

Describe the solution you'd like

[tasks.build]
description = "Build client and server"
# as root-task: enable final-time report when running this task
# as dependency of a task with root-task enabling it also: is included
# in the breakdown of the final time
time = true 
aggregate_times = true
workspace = false
dependencies = ["build_client", "build_server"]

[tasks.build_client]
description = "Build client"
workspace = false
time = false
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
command = "wasm-pack"
args = ["build", "client", "--target", "web", "--out-name", "package", "--dev"]

[tasks.build_server]
description = "Build server"
workspace = false
time = true
command = "cargo"
args = ["build", "--package", "server"]

running the above example with cargo make build, an output might look like this

=== Time Stats ===
Total: 10m 0.00s

Server: 65% (6m 30.0s)
Other: 35% (3m 30.0s, 1 omited)
@sagiegurari
Copy link
Owner

Interesting idea, i will check it out. few notes however,

  • sometimes your build will be splited to multiple processes (wor example when working in a workspace, each member is a sub process) so you will have multiple summaries.
  • it would be turned off by default. you will have to provide some cli flag or value in the makefile config section to turn it on. many people complain it is printing too much as it is, so trying to gate any extra printing.

@sagiegurari sagiegurari added this to the 0.32.2 milestone Aug 13, 2020
sagiegurari added a commit that referenced this issue Aug 17, 2020
@sagiegurari
Copy link
Owner

@Ben-PH I just pushed to the development branch the time summary.
The printout looks as follows:

[cargo-make] INFO - =====Time Summary=====
[cargo-make] INFO - install-rustfmt:             0.00%     0.01 seconds
[cargo-make] INFO - format:                      0.63%     1.44 seconds
[cargo-make] INFO - format-flow:                 0.00%     0.00 seconds
[cargo-make] INFO - build:                       8.44%     19.37 seconds
[cargo-make] INFO - test:                        19.65%    45.11 seconds
[cargo-make] INFO - test-thread-safe:            19.66%    45.12 seconds
[cargo-make] INFO - test-single-threaded:        15.98%    36.67 seconds
[cargo-make] INFO - test-multi-phases-cleanup:   0.00%     0.00 seconds
[cargo-make] INFO - test-multi-phases-flow:      35.65%    81.84 seconds
[cargo-make] INFO - test-flow:                   0.00%     0.00 seconds
[cargo-make] INFO - default:                     0.00%     0.00 seconds

To make it work you will need to either pass the new --time-summary flag or add to the makefile config section the time_summary=true flag.
its automatically turned on in CI env.

Any feedback is welcome 😃

sagiegurari added a commit that referenced this issue Aug 19, 2020
@sagiegurari
Copy link
Owner

this is now released in the new cargo-make version 0.32.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants