summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/usage/usage_state_autogen.go
blob: 50f6d27ba31aecdb34b93333ae143b84fbdeeacf (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 (s *CPUStats) StateTypeName() string {
	return "pkg/sentry/usage.CPUStats"
}

func (s *CPUStats) StateFields() []string {
	return []string{
		"UserTime",
		"SysTime",
		"VoluntarySwitches",
	}
}

func (s *CPUStats) beforeSave() {}

func (s *CPUStats) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.UserTime)
	stateSinkObject.Save(1, &s.SysTime)
	stateSinkObject.Save(2, &s.VoluntarySwitches)
}

func (s *CPUStats) afterLoad() {}

func (s *CPUStats) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.UserTime)
	stateSourceObject.Load(1, &s.SysTime)
	stateSourceObject.Load(2, &s.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))
}