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 <alakeshh@amazon.com>
This commit is contained in:
parent
a5d17eb507
commit
9f5244f410
@ -19,6 +19,7 @@ package images
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http/httptrace"
|
"net/http/httptrace"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||||
@ -124,6 +125,7 @@ command. As part of this process, we do the following:
|
|||||||
p = append(p, platforms.DefaultSpec())
|
p = append(p, platforms.DefaultSpec())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
for _, platform := range p {
|
for _, platform := range p {
|
||||||
fmt.Printf("unpacking %s %s...\n", platforms.Format(platform), img.Target.Digest)
|
fmt.Printf("unpacking %s %s...\n", platforms.Format(platform), img.Target.Digest)
|
||||||
i := containerd.NewImageWithPlatform(client, img, platforms.Only(platform))
|
i := containerd.NewImageWithPlatform(client, img, platforms.Only(platform))
|
||||||
@ -140,8 +142,7 @@ command. As part of this process, we do the following:
|
|||||||
fmt.Printf("image chain ID: %s\n", chainID)
|
fmt.Printf("image chain ID: %s\n", chainID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Printf("done: %s\t\n", time.Since(start))
|
||||||
fmt.Println("done")
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user