예제 #1
0
    def get_dico(self):
        self.compute_processing_time()
        to_ret = objToDictionnary(self)

        # sum
        to_ret['bytes_in'] = self._bytes_in.get_sum()
        to_ret['bytes_out'] = self._bytes_out.get_sum()
        to_ret['flowItem_in'] = self._flowItem_in.get_sum()
        to_ret['flowItem_out'] = self._flowItem_out.get_sum()

        # history
        to_ret['bytes_in_history'] = self._bytes_in.get_history(
            self.timerange_history)
        to_ret['bytes_out_history'] = self._bytes_out.get_history(
            self.timerange_history)
        to_ret['flowItem_in_history'] = self._flowItem_in.get_history(
            self.timerange_history)
        to_ret['flowItem_out_history'] = self._flowItem_out.get_history(
            self.timerange_history)

        # speed: sum/resolution
        to_ret['bytes_in_speed'] = [[t, elem / self.timeSpannedResolution]
                                    for t, elem in to_ret['bytes_in_history']]
        to_ret['bytes_out_speed'] = [[t, elem / self.timeSpannedResolution]
                                     for t, elem in to_ret['bytes_out_history']
                                     ]
        to_ret['flowItem_in_speed'] = [[
            t, elem / self.timeSpannedResolution
        ] for t, elem in to_ret['flowItem_in_history']]
        to_ret['flowItem_out_speed'] = [[
            t, elem / self.timeSpannedResolution
        ] for t, elem in to_ret['flowItem_out_history']]

        return to_ret
예제 #2
0
 def get_representation(self, full=False):
     pInfo = objToDictionnary(self, full=full, to_ignore=['logger'])
     dStat = self._processStat.get_dico()
     dStat.update(self.get_system_info())
     pInfo['stats'] = dStat
     pInfo['representationTimestamp'] = time.time()
     return pInfo
예제 #3
0
 def get_buffers_info(self):
     self.logger.debug('Getting buffers info')
     info = []
     for buuid in self.buffers_uuid:
         binfo = objToDictionnary(self.buffers[buuid])
         realtime_binfo = self._buffer_metadata_interface.get_info(
             buuid)  # realtime info
         binfo['stats'] = realtime_binfo
         info.append(binfo)
     return info
예제 #4
0
 def __repr__(self):
     return json.dumps(objToDictionnary(self))
예제 #5
0
 def __repr__(self):
     return json.dumps(objToDictionnary(self, full=False))
예제 #6
0
 def gen_buffer_config(self):
     return objToDictionnary(self, full=False)
예제 #7
0
 def gen_process_config(self):
     return objToDictionnary(self, full=False)