summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2021-11-09 21:21:07 +0000
committerAdrian Reber <areber@redhat.com>2021-11-15 11:50:25 +0000
commit80e56fa12b7bf7e19a768ce9a3beeeeb53f9b33d (patch)
tree4551d5469e7da0836b9d8e8b5239d0c3bcb98ec7 /libpod/oci.go
parent6202e8102b9728f89c2ab7bb504306a2bd007878 (diff)
downloadpodman-80e56fa12b7bf7e19a768ce9a3beeeeb53f9b33d.tar.gz
podman-80e56fa12b7bf7e19a768ce9a3beeeeb53f9b33d.tar.bz2
podman-80e56fa12b7bf7e19a768ce9a3beeeeb53f9b33d.zip
Added optional container restore statistics
This adds the parameter '--print-stats' to 'podman container restore'. With '--print-stats' Podman will measure how long Podman itself, the OCI runtime and CRIU requires to restore a checkpoint and print out these information. CRIU already creates process restore statistics which are just read in addition to the added measurements. In contrast to just printing out the ID of the restored container, Podman will now print out JSON: # podman container restore --latest --print-stats { "podman_restore_duration": 305871, "container_statistics": [ { "Id": "47b02e1d474b5d5fe917825e91ac653efa757c91e5a81a368d771a78f6b5ed20", "runtime_restore_duration": 140614, "criu_statistics": { "forking_time": 5, "restore_time": 67672, "pages_restored": 14 } } ] } The output contains 'podman_restore_duration' which contains the number of microseconds Podman required to restore the checkpoint. The output also includes 'runtime_restore_duration' which is the time the runtime needed to restore that specific container. Each container also includes 'criu_statistics' which displays the timing information collected by CRIU. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index f78600210..f45c1a105 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -23,7 +23,10 @@ type OCIRuntime interface {
Path() string
// CreateContainer creates the container in the OCI runtime.
- CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) error
+ // The returned int64 contains the microseconds needed to restore
+ // the given container if it is a restore and if restoreOptions.PrintStats
+ // is true. In all other cases the returned int64 is 0.
+ CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) (int64, error)
// UpdateContainerStatus updates the status of the given container.
UpdateContainerStatus(ctr *Container) error
// StartContainer starts the given container.