Go to the documentation of this file.00001 """autogenerated by genpy from rve_msgs/NVPerfCounters.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import rve_msgs.msg
00008
00009 class NVPerfCounters(genpy.Message):
00010 _md5sum = "5e6d8b4f9afd5f75c05d9967d6d170a9"
00011 _type = "rve_msgs/NVPerfCounters"
00012 _has_header = False
00013 _full_text = """NVPerfCounter[] counters
00014 string gpu_bottleneck
00015 ================================================================================
00016 MSG: rve_msgs/NVPerfCounter
00017 string name
00018 uint64 value
00019 uint64 cycles
00020 float64 value_as_pct
00021 """
00022 __slots__ = ['counters','gpu_bottleneck']
00023 _slot_types = ['rve_msgs/NVPerfCounter[]','string']
00024
00025 def __init__(self, *args, **kwds):
00026 """
00027 Constructor. Any message fields that are implicitly/explicitly
00028 set to None will be assigned a default value. The recommend
00029 use is keyword arguments as this is more robust to future message
00030 changes. You cannot mix in-order arguments and keyword arguments.
00031
00032 The available fields are:
00033 counters,gpu_bottleneck
00034
00035 :param args: complete set of field values, in .msg order
00036 :param kwds: use keyword arguments corresponding to message field names
00037 to set specific fields.
00038 """
00039 if args or kwds:
00040 super(NVPerfCounters, self).__init__(*args, **kwds)
00041
00042 if self.counters is None:
00043 self.counters = []
00044 if self.gpu_bottleneck is None:
00045 self.gpu_bottleneck = ''
00046 else:
00047 self.counters = []
00048 self.gpu_bottleneck = ''
00049
00050 def _get_types(self):
00051 """
00052 internal API method
00053 """
00054 return self._slot_types
00055
00056 def serialize(self, buff):
00057 """
00058 serialize message into buffer
00059 :param buff: buffer, ``StringIO``
00060 """
00061 try:
00062 length = len(self.counters)
00063 buff.write(_struct_I.pack(length))
00064 for val1 in self.counters:
00065 _x = val1.name
00066 length = len(_x)
00067 if python3 or type(_x) == unicode:
00068 _x = _x.encode('utf-8')
00069 length = len(_x)
00070 buff.write(struct.pack('<I%ss'%length, length, _x))
00071 _x = val1
00072 buff.write(_struct_2Qd.pack(_x.value, _x.cycles, _x.value_as_pct))
00073 _x = self.gpu_bottleneck
00074 length = len(_x)
00075 if python3 or type(_x) == unicode:
00076 _x = _x.encode('utf-8')
00077 length = len(_x)
00078 buff.write(struct.pack('<I%ss'%length, length, _x))
00079 except struct.error as se: self._check_types(se)
00080 except TypeError as te: self._check_types(te)
00081
00082 def deserialize(self, str):
00083 """
00084 unpack serialized message in str into this message instance
00085 :param str: byte array of serialized message, ``str``
00086 """
00087 try:
00088 if self.counters is None:
00089 self.counters = None
00090 end = 0
00091 start = end
00092 end += 4
00093 (length,) = _struct_I.unpack(str[start:end])
00094 self.counters = []
00095 for i in range(0, length):
00096 val1 = rve_msgs.msg.NVPerfCounter()
00097 start = end
00098 end += 4
00099 (length,) = _struct_I.unpack(str[start:end])
00100 start = end
00101 end += length
00102 if python3:
00103 val1.name = str[start:end].decode('utf-8')
00104 else:
00105 val1.name = str[start:end]
00106 _x = val1
00107 start = end
00108 end += 24
00109 (_x.value, _x.cycles, _x.value_as_pct,) = _struct_2Qd.unpack(str[start:end])
00110 self.counters.append(val1)
00111 start = end
00112 end += 4
00113 (length,) = _struct_I.unpack(str[start:end])
00114 start = end
00115 end += length
00116 if python3:
00117 self.gpu_bottleneck = str[start:end].decode('utf-8')
00118 else:
00119 self.gpu_bottleneck = str[start:end]
00120 return self
00121 except struct.error as e:
00122 raise genpy.DeserializationError(e)
00123
00124
00125 def serialize_numpy(self, buff, numpy):
00126 """
00127 serialize message with numpy array types into buffer
00128 :param buff: buffer, ``StringIO``
00129 :param numpy: numpy python module
00130 """
00131 try:
00132 length = len(self.counters)
00133 buff.write(_struct_I.pack(length))
00134 for val1 in self.counters:
00135 _x = val1.name
00136 length = len(_x)
00137 if python3 or type(_x) == unicode:
00138 _x = _x.encode('utf-8')
00139 length = len(_x)
00140 buff.write(struct.pack('<I%ss'%length, length, _x))
00141 _x = val1
00142 buff.write(_struct_2Qd.pack(_x.value, _x.cycles, _x.value_as_pct))
00143 _x = self.gpu_bottleneck
00144 length = len(_x)
00145 if python3 or type(_x) == unicode:
00146 _x = _x.encode('utf-8')
00147 length = len(_x)
00148 buff.write(struct.pack('<I%ss'%length, length, _x))
00149 except struct.error as se: self._check_types(se)
00150 except TypeError as te: self._check_types(te)
00151
00152 def deserialize_numpy(self, str, numpy):
00153 """
00154 unpack serialized message in str into this message instance using numpy for array types
00155 :param str: byte array of serialized message, ``str``
00156 :param numpy: numpy python module
00157 """
00158 try:
00159 if self.counters is None:
00160 self.counters = None
00161 end = 0
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 self.counters = []
00166 for i in range(0, length):
00167 val1 = rve_msgs.msg.NVPerfCounter()
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 start = end
00172 end += length
00173 if python3:
00174 val1.name = str[start:end].decode('utf-8')
00175 else:
00176 val1.name = str[start:end]
00177 _x = val1
00178 start = end
00179 end += 24
00180 (_x.value, _x.cycles, _x.value_as_pct,) = _struct_2Qd.unpack(str[start:end])
00181 self.counters.append(val1)
00182 start = end
00183 end += 4
00184 (length,) = _struct_I.unpack(str[start:end])
00185 start = end
00186 end += length
00187 if python3:
00188 self.gpu_bottleneck = str[start:end].decode('utf-8')
00189 else:
00190 self.gpu_bottleneck = str[start:end]
00191 return self
00192 except struct.error as e:
00193 raise genpy.DeserializationError(e)
00194
00195 _struct_I = genpy.struct_I
00196 _struct_2Qd = struct.Struct("<2Qd")