podman/libpod/define/checkpoint_restore.go
Adrian Reber 6202e8102b
Added optional container checkpointing statistics
This adds the parameter '--print-stats' to 'podman container checkpoint'.
With '--print-stats' Podman will measure how long Podman itself, the OCI
runtime and CRIU requires to create a checkpoint and print out these
information. CRIU already creates checkpointing statistics which are
just read in addition to the added measurements. In contrast to just
printing out the ID of the checkpointed container, Podman will now print
out JSON:

 # podman container checkpoint --latest --print-stats
 {
     "podman_checkpoint_duration": 360749,
     "container_statistics": [
         {
             "Id": "25244244bf2efbef30fb6857ddea8cb2e5489f07eb6659e20dda117f0c466808",
             "runtime_checkpoint_duration": 177222,
             "criu_statistics": {
                 "freezing_time": 100657,
                 "frozen_time": 60700,
                 "memdump_time": 8162,
                 "memwrite_time": 4224,
                 "pages_scanned": 20561,
                 "pages_written": 2129
             }
         }
     ]
 }

The output contains 'podman_checkpoint_duration' which contains the
number of microseconds Podman required to create the checkpoint. The
output also includes 'runtime_checkpoint_duration' which is the time
the runtime needed to checkpoint 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>
2021-11-15 11:50:24 +00:00

33 lines
1.3 KiB
Go

package define
// This contains values reported by CRIU during
// checkpointing or restoring.
// All names are the same as reported by CRIU.
type CRIUCheckpointRestoreStatistics struct {
// Checkpoint values
// Time required to freeze/pause/quiesce the processes
FreezingTime uint32 `json:"freezing_time,omitempty"`
// Time the processes are actually not running during checkpointing
FrozenTime uint32 `json:"frozen_time,omitempty"`
// Time required to extract memory pages from the processes
MemdumpTime uint32 `json:"memdump_time,omitempty"`
// Time required to write memory pages to disk
MemwriteTime uint32 `json:"memwrite_time,omitempty"`
// Number of memory pages CRIU analyzed
PagesScanned uint64 `json:"pages_scanned,omitempty"`
// Number of memory pages written
PagesWritten uint64 `json:"pages_written,omitempty"`
// Restore values
// Number of pages compared during restore
PagesCompared uint64 `json:"pages_compared,omitempty"`
// Number of COW pages skipped during restore
PagesSkippedCow uint64 `json:"pages_skipped_cow,omitempty"`
// Time required to fork processes
ForkingTime uint32 `json:"forking_time,omitempty"`
// Time required to restore
RestoreTime uint32 `json:"restore_time,omitempty"`
// Number of memory pages restored
PagesRestored uint64 `json:"pages_restored,omitempty"`
}