summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/state/state.go
diff options
context:
space:
mode:
authorZhaozhong Ni <nzz@google.com>2018-05-04 13:55:06 -0700
committerShentubot <shentubot@google.com>2018-05-04 13:55:53 -0700
commit0ce9c81b416494e3c3da793c278dfc767341fa6d (patch)
tree90e2af4bac14167f57694b0457fb0dec3bc2f945 /pkg/sentry/state/state.go
parent7bb10dc7a0499e20a37291d6f5fd105e6ae6fdbf (diff)
sentry: capture CPU usage metadata for save.
PiperOrigin-RevId: 195466647 Change-Id: Ib5ca815f7b64a4881441e58567adedf344b206f1
Diffstat (limited to 'pkg/sentry/state/state.go')
-rw-r--r--pkg/sentry/state/state.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/sentry/state/state.go b/pkg/sentry/state/state.go
index 5bec4e018..c306091da 100644
--- a/pkg/sentry/state/state.go
+++ b/pkg/sentry/state/state.go
@@ -27,6 +27,8 @@ import (
"gvisor.googlesource.com/gvisor/pkg/state/statefile"
)
+var previousMetadata map[string]string
+
// ErrStateFile is returned when the state file cannot be opened.
type ErrStateFile struct {
err error
@@ -103,11 +105,13 @@ type LoadOpts struct {
// Load loads the given kernel, setting the provided platform and stack.
func (opts LoadOpts) Load(k *kernel.Kernel, p platform.Platform, n inet.Stack) error {
// Open the file.
- r, _, err := statefile.NewReader(opts.Source, opts.Key)
+ r, m, err := statefile.NewReader(opts.Source, opts.Key)
if err != nil {
return ErrStateFile{err}
}
+ previousMetadata = m
+
// Restore the Kernel object graph.
return k.LoadFrom(r, p, n)
}