00001 """autogenerated by genpy from rve_msgs/FrameStats.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 FrameStats(genpy.Message):
00010 _md5sum = "e0aafbdbfcf683828be95d21dfa3dfb2"
00011 _type = "rve_msgs/FrameStats"
00012 _has_header = False
00013 _full_text = """float64 total_frame_time
00014
00015 RenderTargetFrameStats[] render_window_stats
00016 NVPerfCounters nv_perf_counters
00017
00018 ================================================================================
00019 MSG: rve_msgs/RenderTargetFrameStats
00020 UUID id
00021
00022 float64 blit_to_main
00023 float64 main_swap
00024
00025 float64 gbuffer_update
00026 float64 gbuffer_swap
00027 ================================================================================
00028 MSG: rve_msgs/UUID
00029 uint8[16] data
00030
00031 ================================================================================
00032 MSG: rve_msgs/NVPerfCounters
00033 NVPerfCounter[] counters
00034 string gpu_bottleneck
00035 ================================================================================
00036 MSG: rve_msgs/NVPerfCounter
00037 string name
00038 uint64 value
00039 uint64 cycles
00040 float64 value_as_pct
00041 """
00042 __slots__ = ['total_frame_time','render_window_stats','nv_perf_counters']
00043 _slot_types = ['float64','rve_msgs/RenderTargetFrameStats[]','rve_msgs/NVPerfCounters']
00044
00045 def __init__(self, *args, **kwds):
00046 """
00047 Constructor. Any message fields that are implicitly/explicitly
00048 set to None will be assigned a default value. The recommend
00049 use is keyword arguments as this is more robust to future message
00050 changes. You cannot mix in-order arguments and keyword arguments.
00051
00052 The available fields are:
00053 total_frame_time,render_window_stats,nv_perf_counters
00054
00055 :param args: complete set of field values, in .msg order
00056 :param kwds: use keyword arguments corresponding to message field names
00057 to set specific fields.
00058 """
00059 if args or kwds:
00060 super(FrameStats, self).__init__(*args, **kwds)
00061
00062 if self.total_frame_time is None:
00063 self.total_frame_time = 0.
00064 if self.render_window_stats is None:
00065 self.render_window_stats = []
00066 if self.nv_perf_counters is None:
00067 self.nv_perf_counters = rve_msgs.msg.NVPerfCounters()
00068 else:
00069 self.total_frame_time = 0.
00070 self.render_window_stats = []
00071 self.nv_perf_counters = rve_msgs.msg.NVPerfCounters()
00072
00073 def _get_types(self):
00074 """
00075 internal API method
00076 """
00077 return self._slot_types
00078
00079 def serialize(self, buff):
00080 """
00081 serialize message into buffer
00082 :param buff: buffer, ``StringIO``
00083 """
00084 try:
00085 buff.write(_struct_d.pack(self.total_frame_time))
00086 length = len(self.render_window_stats)
00087 buff.write(_struct_I.pack(length))
00088 for val1 in self.render_window_stats:
00089 _v1 = val1.id
00090 _x = _v1.data
00091
00092 if type(_x) in [list, tuple]:
00093 buff.write(_struct_16B.pack(*_x))
00094 else:
00095 buff.write(_struct_16s.pack(_x))
00096 _x = val1
00097 buff.write(_struct_4d.pack(_x.blit_to_main, _x.main_swap, _x.gbuffer_update, _x.gbuffer_swap))
00098 length = len(self.nv_perf_counters.counters)
00099 buff.write(_struct_I.pack(length))
00100 for val1 in self.nv_perf_counters.counters:
00101 _x = val1.name
00102 length = len(_x)
00103 if python3 or type(_x) == unicode:
00104 _x = _x.encode('utf-8')
00105 length = len(_x)
00106 buff.write(struct.pack('<I%ss'%length, length, _x))
00107 _x = val1
00108 buff.write(_struct_2Qd.pack(_x.value, _x.cycles, _x.value_as_pct))
00109 _x = self.nv_perf_counters.gpu_bottleneck
00110 length = len(_x)
00111 if python3 or type(_x) == unicode:
00112 _x = _x.encode('utf-8')
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 except struct.error as se: self._check_types(se)
00116 except TypeError as te: self._check_types(te)
00117
00118 def deserialize(self, str):
00119 """
00120 unpack serialized message in str into this message instance
00121 :param str: byte array of serialized message, ``str``
00122 """
00123 try:
00124 if self.render_window_stats is None:
00125 self.render_window_stats = None
00126 if self.nv_perf_counters is None:
00127 self.nv_perf_counters = rve_msgs.msg.NVPerfCounters()
00128 end = 0
00129 start = end
00130 end += 8
00131 (self.total_frame_time,) = _struct_d.unpack(str[start:end])
00132 start = end
00133 end += 4
00134 (length,) = _struct_I.unpack(str[start:end])
00135 self.render_window_stats = []
00136 for i in range(0, length):
00137 val1 = rve_msgs.msg.RenderTargetFrameStats()
00138 _v2 = val1.id
00139 start = end
00140 end += 16
00141 _v2.data = str[start:end]
00142 _x = val1
00143 start = end
00144 end += 32
00145 (_x.blit_to_main, _x.main_swap, _x.gbuffer_update, _x.gbuffer_swap,) = _struct_4d.unpack(str[start:end])
00146 self.render_window_stats.append(val1)
00147 start = end
00148 end += 4
00149 (length,) = _struct_I.unpack(str[start:end])
00150 self.nv_perf_counters.counters = []
00151 for i in range(0, length):
00152 val1 = rve_msgs.msg.NVPerfCounter()
00153 start = end
00154 end += 4
00155 (length,) = _struct_I.unpack(str[start:end])
00156 start = end
00157 end += length
00158 if python3:
00159 val1.name = str[start:end].decode('utf-8')
00160 else:
00161 val1.name = str[start:end]
00162 _x = val1
00163 start = end
00164 end += 24
00165 (_x.value, _x.cycles, _x.value_as_pct,) = _struct_2Qd.unpack(str[start:end])
00166 self.nv_perf_counters.counters.append(val1)
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 start = end
00171 end += length
00172 if python3:
00173 self.nv_perf_counters.gpu_bottleneck = str[start:end].decode('utf-8')
00174 else:
00175 self.nv_perf_counters.gpu_bottleneck = str[start:end]
00176 return self
00177 except struct.error as e:
00178 raise genpy.DeserializationError(e)
00179
00180
00181 def serialize_numpy(self, buff, numpy):
00182 """
00183 serialize message with numpy array types into buffer
00184 :param buff: buffer, ``StringIO``
00185 :param numpy: numpy python module
00186 """
00187 try:
00188 buff.write(_struct_d.pack(self.total_frame_time))
00189 length = len(self.render_window_stats)
00190 buff.write(_struct_I.pack(length))
00191 for val1 in self.render_window_stats:
00192 _v3 = val1.id
00193 _x = _v3.data
00194
00195 if type(_x) in [list, tuple]:
00196 buff.write(_struct_16B.pack(*_x))
00197 else:
00198 buff.write(_struct_16s.pack(_x))
00199 _x = val1
00200 buff.write(_struct_4d.pack(_x.blit_to_main, _x.main_swap, _x.gbuffer_update, _x.gbuffer_swap))
00201 length = len(self.nv_perf_counters.counters)
00202 buff.write(_struct_I.pack(length))
00203 for val1 in self.nv_perf_counters.counters:
00204 _x = val1.name
00205 length = len(_x)
00206 if python3 or type(_x) == unicode:
00207 _x = _x.encode('utf-8')
00208 length = len(_x)
00209 buff.write(struct.pack('<I%ss'%length, length, _x))
00210 _x = val1
00211 buff.write(_struct_2Qd.pack(_x.value, _x.cycles, _x.value_as_pct))
00212 _x = self.nv_perf_counters.gpu_bottleneck
00213 length = len(_x)
00214 if python3 or type(_x) == unicode:
00215 _x = _x.encode('utf-8')
00216 length = len(_x)
00217 buff.write(struct.pack('<I%ss'%length, length, _x))
00218 except struct.error as se: self._check_types(se)
00219 except TypeError as te: self._check_types(te)
00220
00221 def deserialize_numpy(self, str, numpy):
00222 """
00223 unpack serialized message in str into this message instance using numpy for array types
00224 :param str: byte array of serialized message, ``str``
00225 :param numpy: numpy python module
00226 """
00227 try:
00228 if self.render_window_stats is None:
00229 self.render_window_stats = None
00230 if self.nv_perf_counters is None:
00231 self.nv_perf_counters = rve_msgs.msg.NVPerfCounters()
00232 end = 0
00233 start = end
00234 end += 8
00235 (self.total_frame_time,) = _struct_d.unpack(str[start:end])
00236 start = end
00237 end += 4
00238 (length,) = _struct_I.unpack(str[start:end])
00239 self.render_window_stats = []
00240 for i in range(0, length):
00241 val1 = rve_msgs.msg.RenderTargetFrameStats()
00242 _v4 = val1.id
00243 start = end
00244 end += 16
00245 _v4.data = str[start:end]
00246 _x = val1
00247 start = end
00248 end += 32
00249 (_x.blit_to_main, _x.main_swap, _x.gbuffer_update, _x.gbuffer_swap,) = _struct_4d.unpack(str[start:end])
00250 self.render_window_stats.append(val1)
00251 start = end
00252 end += 4
00253 (length,) = _struct_I.unpack(str[start:end])
00254 self.nv_perf_counters.counters = []
00255 for i in range(0, length):
00256 val1 = rve_msgs.msg.NVPerfCounter()
00257 start = end
00258 end += 4
00259 (length,) = _struct_I.unpack(str[start:end])
00260 start = end
00261 end += length
00262 if python3:
00263 val1.name = str[start:end].decode('utf-8')
00264 else:
00265 val1.name = str[start:end]
00266 _x = val1
00267 start = end
00268 end += 24
00269 (_x.value, _x.cycles, _x.value_as_pct,) = _struct_2Qd.unpack(str[start:end])
00270 self.nv_perf_counters.counters.append(val1)
00271 start = end
00272 end += 4
00273 (length,) = _struct_I.unpack(str[start:end])
00274 start = end
00275 end += length
00276 if python3:
00277 self.nv_perf_counters.gpu_bottleneck = str[start:end].decode('utf-8')
00278 else:
00279 self.nv_perf_counters.gpu_bottleneck = str[start:end]
00280 return self
00281 except struct.error as e:
00282 raise genpy.DeserializationError(e)
00283
00284 _struct_I = genpy.struct_I
00285 _struct_2Qd = struct.Struct("<2Qd")
00286 _struct_4d = struct.Struct("<4d")
00287 _struct_d = struct.Struct("<d")
00288 _struct_16B = struct.Struct("<16B")
00289 _struct_16s = struct.Struct("<16s")