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..a117ad216
--- /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 (x *CPUStats) StateTypeName() string {
+ return "pkg/sentry/usage.CPUStats"
+}
+
+func (x *CPUStats) StateFields() []string {
+ return []string{
+ "UserTime",
+ "SysTime",
+ "VoluntarySwitches",
+ }
+}
+
+func (x *CPUStats) beforeSave() {}
+
+func (x *CPUStats) StateSave(m state.Sink) {
+ x.beforeSave()
+ m.Save(0, &x.UserTime)
+ m.Save(1, &x.SysTime)
+ m.Save(2, &x.VoluntarySwitches)
+}
+
+func (x *CPUStats) afterLoad() {}
+
+func (x *CPUStats) StateLoad(m state.Source) {
+ m.Load(0, &x.UserTime)
+ m.Load(1, &x.SysTime)
+ m.Load(2, &x.VoluntarySwitches)
+}
+
+func (x *IO) StateTypeName() string {
+ return "pkg/sentry/usage.IO"
+}
+
+func (x *IO) StateFields() []string {
+ return []string{
+ "CharsRead",
+ "CharsWritten",
+ "ReadSyscalls",
+ "WriteSyscalls",
+ "BytesRead",
+ "BytesWritten",
+ "BytesWriteCancelled",
+ }
+}
+
+func (x *IO) beforeSave() {}
+
+func (x *IO) StateSave(m state.Sink) {
+ x.beforeSave()
+ m.Save(0, &x.CharsRead)
+ m.Save(1, &x.CharsWritten)
+ m.Save(2, &x.ReadSyscalls)
+ m.Save(3, &x.WriteSyscalls)
+ m.Save(4, &x.BytesRead)
+ m.Save(5, &x.BytesWritten)
+ m.Save(6, &x.BytesWriteCancelled)
+}
+
+func (x *IO) afterLoad() {}
+
+func (x *IO) StateLoad(m state.Source) {
+ m.Load(0, &x.CharsRead)
+ m.Load(1, &x.CharsWritten)
+ m.Load(2, &x.ReadSyscalls)
+ m.Load(3, &x.WriteSyscalls)
+ m.Load(4, &x.BytesRead)
+ m.Load(5, &x.BytesWritten)
+ m.Load(6, &x.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