Skip to content

Commit 9f5244f

Browse files
committed
Print elapsed time for image unpack
The provides additional insight into how much time is being spent in unpacking and is helpful in performance comparison for just this stage without resorting to running under time command in linux for example. Signed-off-by: Alakesh Haloi <[email protected]>
1 parent a5d17eb commit 9f5244f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

cmd/ctr/commands/images/pull.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package images
1919
import (
2020
"fmt"
2121
"net/http/httptrace"
22+
"time"
2223

2324
"github.com/containerd/containerd"
2425
"github.com/containerd/containerd/cmd/ctr/commands"
@@ -124,6 +125,7 @@ command. As part of this process, we do the following:
124125
p = append(p, platforms.DefaultSpec())
125126
}
126127

128+
start := time.Now()
127129
for _, platform := range p {
128130
fmt.Printf("unpacking %s %s...\n", platforms.Format(platform), img.Target.Digest)
129131
i := containerd.NewImageWithPlatform(client, img, platforms.Only(platform))
@@ -140,8 +142,7 @@ command. As part of this process, we do the following:
140142
fmt.Printf("image chain ID: %s\n", chainID)
141143
}
142144
}
143-
144-
fmt.Println("done")
145+
fmt.Printf("done: %s\t\n", time.Since(start))
145146
return nil
146147
},
147148
}

0 commit comments

Comments
 (0)