github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/sentry/usage/usage_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package usage
     4  
     5  import (
     6  	"github.com/nicocha30/gvisor-ligolo/pkg/state"
     7  )
     8  
     9  func (s *CPUStats) StateTypeName() string {
    10  	return "pkg/sentry/usage.CPUStats"
    11  }
    12  
    13  func (s *CPUStats) StateFields() []string {
    14  	return []string{
    15  		"UserTime",
    16  		"SysTime",
    17  		"VoluntarySwitches",
    18  	}
    19  }
    20  
    21  func (s *CPUStats) beforeSave() {}
    22  
    23  // +checklocksignore
    24  func (s *CPUStats) StateSave(stateSinkObject state.Sink) {
    25  	s.beforeSave()
    26  	stateSinkObject.Save(0, &s.UserTime)
    27  	stateSinkObject.Save(1, &s.SysTime)
    28  	stateSinkObject.Save(2, &s.VoluntarySwitches)
    29  }
    30  
    31  func (s *CPUStats) afterLoad() {}
    32  
    33  // +checklocksignore
    34  func (s *CPUStats) StateLoad(stateSourceObject state.Source) {
    35  	stateSourceObject.Load(0, &s.UserTime)
    36  	stateSourceObject.Load(1, &s.SysTime)
    37  	stateSourceObject.Load(2, &s.VoluntarySwitches)
    38  }
    39  
    40  func (i *IO) StateTypeName() string {
    41  	return "pkg/sentry/usage.IO"
    42  }
    43  
    44  func (i *IO) StateFields() []string {
    45  	return []string{
    46  		"CharsRead",
    47  		"CharsWritten",
    48  		"ReadSyscalls",
    49  		"WriteSyscalls",
    50  		"BytesRead",
    51  		"BytesWritten",
    52  		"BytesWriteCancelled",
    53  	}
    54  }
    55  
    56  func (i *IO) beforeSave() {}
    57  
    58  // +checklocksignore
    59  func (i *IO) StateSave(stateSinkObject state.Sink) {
    60  	i.beforeSave()
    61  	stateSinkObject.Save(0, &i.CharsRead)
    62  	stateSinkObject.Save(1, &i.CharsWritten)
    63  	stateSinkObject.Save(2, &i.ReadSyscalls)
    64  	stateSinkObject.Save(3, &i.WriteSyscalls)
    65  	stateSinkObject.Save(4, &i.BytesRead)
    66  	stateSinkObject.Save(5, &i.BytesWritten)
    67  	stateSinkObject.Save(6, &i.BytesWriteCancelled)
    68  }
    69  
    70  func (i *IO) afterLoad() {}
    71  
    72  // +checklocksignore
    73  func (i *IO) StateLoad(stateSourceObject state.Source) {
    74  	stateSourceObject.Load(0, &i.CharsRead)
    75  	stateSourceObject.Load(1, &i.CharsWritten)
    76  	stateSourceObject.Load(2, &i.ReadSyscalls)
    77  	stateSourceObject.Load(3, &i.WriteSyscalls)
    78  	stateSourceObject.Load(4, &i.BytesRead)
    79  	stateSourceObject.Load(5, &i.BytesWritten)
    80  	stateSourceObject.Load(6, &i.BytesWriteCancelled)
    81  }
    82  
    83  func init() {
    84  	state.Register((*CPUStats)(nil))
    85  	state.Register((*IO)(nil))
    86  }