summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/usage/usage_state_autogen.go
blob: a117ad216a8323f93007bb6fdf8ae2ddc5f4848e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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))
}