summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/usage
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/usage')
-rw-r--r--pkg/sentry/usage/BUILD22
-rw-r--r--pkg/sentry/usage/usage_state_autogen.go82
-rw-r--r--pkg/sentry/usage/usage_unsafe_state_autogen.go3
3 files changed, 85 insertions, 22 deletions
diff --git a/pkg/sentry/usage/BUILD b/pkg/sentry/usage/BUILD
deleted file mode 100644
index 099315613..000000000
--- a/pkg/sentry/usage/BUILD
+++ /dev/null
@@ -1,22 +0,0 @@
-load("//tools:defs.bzl", "go_library")
-
-package(licenses = ["notice"])
-
-go_library(
- name = "usage",
- srcs = [
- "cpu.go",
- "io.go",
- "memory.go",
- "memory_unsafe.go",
- "usage.go",
- ],
- visibility = [
- "//:sandbox",
- ],
- deps = [
- "//pkg/bits",
- "//pkg/memutil",
- "//pkg/sync",
- ],
-)
diff --git a/pkg/sentry/usage/usage_state_autogen.go b/pkg/sentry/usage/usage_state_autogen.go
new file mode 100644
index 000000000..0ef018bac
--- /dev/null
+++ b/pkg/sentry/usage/usage_state_autogen.go
@@ -0,0 +1,82 @@
+// automatically generated by stateify.
+
+package usage
+
+import (
+ "gvisor.dev/gvisor/pkg/state"
+)
+
+func (c *CPUStats) StateTypeName() string {
+ return "pkg/sentry/usage.CPUStats"
+}
+
+func (c *CPUStats) StateFields() []string {
+ return []string{
+ "UserTime",
+ "SysTime",
+ "VoluntarySwitches",
+ }
+}
+
+func (c *CPUStats) beforeSave() {}
+
+func (c *CPUStats) StateSave(stateSinkObject state.Sink) {
+ c.beforeSave()
+ stateSinkObject.Save(0, &c.UserTime)
+ stateSinkObject.Save(1, &c.SysTime)
+ stateSinkObject.Save(2, &c.VoluntarySwitches)
+}
+
+func (c *CPUStats) afterLoad() {}
+
+func (c *CPUStats) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &c.UserTime)
+ stateSourceObject.Load(1, &c.SysTime)
+ stateSourceObject.Load(2, &c.VoluntarySwitches)
+}
+
+func (i *IO) StateTypeName() string {
+ return "pkg/sentry/usage.IO"
+}
+
+func (i *IO) StateFields() []string {
+ return []string{
+ "CharsRead",
+ "CharsWritten",
+ "ReadSyscalls",
+ "WriteSyscalls",
+ "BytesRead",
+ "BytesWritten",
+ "BytesWriteCancelled",
+ }
+}
+
+func (i *IO) beforeSave() {}
+
+func (i *IO) StateSave(stateSinkObject state.Sink) {
+ i.beforeSave()
+ stateSinkObject.Save(0, &i.CharsRead)
+ stateSinkObject.Save(1, &i.CharsWritten)
+ stateSinkObject.Save(2, &i.ReadSyscalls)
+ stateSinkObject.Save(3, &i.WriteSyscalls)
+ stateSinkObject.Save(4, &i.BytesRead)
+ stateSinkObject.Save(5, &i.BytesWritten)
+ stateSinkObject.Save(6, &i.BytesWriteCancelled)
+}
+
+func (i *IO) afterLoad() {}
+
+func (i *IO) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &i.CharsRead)
+ stateSourceObject.Load(1, &i.CharsWritten)
+ stateSourceObject.Load(2, &i.ReadSyscalls)
+ stateSourceObject.Load(3, &i.WriteSyscalls)
+ stateSourceObject.Load(4, &i.BytesRead)
+ stateSourceObject.Load(5, &i.BytesWritten)
+ stateSourceObject.Load(6, &i.BytesWriteCancelled)
+}
+
+func init() {
+ state.Register((*CPUStats)(nil))
+ state.Register((*IO)(nil))
+}
diff --git a/pkg/sentry/usage/usage_unsafe_state_autogen.go b/pkg/sentry/usage/usage_unsafe_state_autogen.go
new file mode 100644
index 000000000..5d9e86efa
--- /dev/null
+++ b/pkg/sentry/usage/usage_unsafe_state_autogen.go
@@ -0,0 +1,3 @@
+// automatically generated by stateify.
+
+package usage