// 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))
}