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

cmd/snap: tweak the output of snap debug timings --ensure=... #6896

Merged
merged 2 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/snap/cmd_debug_timings.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ func (x *cmdChangeTimings) printChangeTimings(w io.Writer, timing *timingsData)

func (x *cmdChangeTimings) printEnsureTimings(w io.Writer, timings []*timingsData) error {
for _, td := range timings {
printTiming(w, x.Verbose, 0, x.EnsureTag, "", "-", "-", "", "")
for _, t := range td.EnsureTimings {
printTiming(w, x.Verbose, t.Level, "ensure", "", formatDuration(t.Duration), "-", t.Label, t.Summary)
printTiming(w, x.Verbose, t.Level+1, "", "", formatDuration(t.Duration), "-", t.Label, t.Summary)
}

// change is optional for ensure timings
Expand Down
39 changes: 21 additions & 18 deletions cmd/snap/cmd_debug_timings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,31 @@ var timingsTests = []timingsCmdArgs{{
" ^ 1ms - bar bar summary\n\n",
}, {
args: "debug timings --ensure=foo",
stdout: "ID Status Doing Undoing Summary\n" +
"ensure 8ms - baz summary\n" +
" ^ 8ms - booze summary\n" +
"40 Doing 910ms - task bar summary\n" +
" ^ 1ms - foo summary\n" +
" ^ 1ms - bar summary\n\n",
stdout: "ID Status Doing Undoing Summary\n" +
"foo - - \n" +
" ^ 8ms - baz summary\n" +
" ^ 8ms - booze summary\n" +
"40 Doing 910ms - task bar summary\n" +
" ^ 1ms - foo summary\n" +
" ^ 1ms - bar summary\n\n",
}, {
args: "debug timings --ensure=bar --all",
stdout: "ID Status Doing Undoing Summary\n" +
"ensure 8ms - bar summary 1\n" +
"ensure 8ms - bar summary 2\n" +
"40 Doing 910ms - task bar summary\n" +
" ^ 1ms - foo summary\n" +
" ^ 1ms - bar summary\n\n",
stdout: "ID Status Doing Undoing Summary\n" +
"bar - - \n" +
" ^ 8ms - bar summary 1\n" +
" ^ 8ms - bar summary 2\n" +
"40 Doing 910ms - task bar summary\n" +
" ^ 1ms - foo summary\n" +
" ^ 1ms - bar summary\n\n",
}, {
args: "debug timings --ensure=bar --all --verbose",
stdout: "ID Status Doing Undoing Label Summary\n" +
"ensure 8ms - abc bar summary 1\n" +
"ensure 8ms - abc bar summary 2\n" +
"40 Doing 910ms - bar task bar summary\n" +
" ^ 1ms - foo foo summary\n" +
" ^ 1ms - bar bar summary\n\n",
stdout: "ID Status Doing Undoing Label Summary\n" +
"bar - - \n" +
" ^ 8ms - abc bar summary 1\n" +
" ^ 8ms - abc bar summary 2\n" +
"40 Doing 910ms - bar task bar summary\n" +
" ^ 1ms - foo foo summary\n" +
" ^ 1ms - bar bar summary\n\n",
}}

func (s *SnapSuite) TestGetDebugTimings(c *C) {
Expand Down