示例#1
0
 def log_connection_mem_stats(self) -> None:
     """
     logs the connection's memory stats
     """
     class_name = self.__class__.__name__
     hooks.add_obj_mem_stats(
         class_name,
         self.network_num,
         self.inputbuf,
         "input_buffer",
         memory_utils.ObjectSize("input_buffer",
                                 memory_utils.get_special_size(
                                     self.inputbuf).size,
                                 is_actual_size=True),
         object_item_count=len(self.inputbuf.input_list),
         object_type=memory_utils.ObjectType.BASE,
         size_type=memory_utils.SizeType.TRUE)
     hooks.add_obj_mem_stats(
         class_name,
         self.network_num,
         self.outputbuf,
         "output_buffer",
         memory_utils.ObjectSize("output_buffer",
                                 memory_utils.get_special_size(
                                     self.outputbuf).size,
                                 is_actual_size=True),
         object_item_count=len(self.outputbuf.output_msgs),
         object_type=memory_utils.ObjectType.BASE,
         size_type=memory_utils.SizeType.TRUE)
示例#2
0
 def log_connection_mem_stats(self) -> None:
     """
     logs the connection's memory stats
     """
     super(AbstractGatewayBlockchainConnection,
           self).log_connection_mem_stats()
     t0 = time.time()
     class_name = self.__class__.__name__
     if self.node.message_converter is not None:
         hooks.add_obj_mem_stats(class_name,
                                 self.network_num,
                                 self.node.message_converter,
                                 "message_converter",
                                 memory_utils.ObjectSize(
                                     "message_converter",
                                     memory_utils.get_special_size(
                                         self.node.message_converter).size,
                                     is_actual_size=True),
                                 object_item_count=1,
                                 object_type=memory_utils.ObjectType.META,
                                 size_type=memory_utils.SizeType.SPECIAL)
     t_m_c_diff = round(time.time() - t0, 3)
     logger.debug(
         "Recording {} message_converter MemoryStats took: {} seconds",
         class_name, t_m_c_diff)
 def get_collection_mem_stats(
         self,
         collection_obj: Any,
         estimated_size: int = 0) -> memory_utils.ObjectSize:
     if self.get_object_type(
             collection_obj) == memory_utils.ObjectType.DEFAULT_MAP_PROXY:
         collection_size = collection_obj.map_obj.get_bytes_length()
         if collection_obj is self._tx_cache_key_to_short_ids:
             collection_size += (len(self._short_id_to_tx_cache_key) *
                                 constants.UL_INT_SIZE_IN_BYTES)
         return memory_utils.ObjectSize(size=collection_size,
                                        flat_size=0,
                                        is_actual_size=True)
     else:
         return super(ExtensionTransactionService,
                      self).get_collection_mem_stats(
                          collection_obj, estimated_size)
    def log_connection_mem_stats(self) -> None:
        """
        logs the connection's memory stats
        """
        super(AbstractRelayConnection, self).log_connection_mem_stats()

        class_name = self.__class__.__name__
        if self.node.message_converter is not None:
            hooks.add_obj_mem_stats(class_name,
                                    self.network_num,
                                    self.node.message_converter,
                                    "message_converter",
                                    memory_utils.ObjectSize(
                                        "message_converter",
                                        memory_utils.get_special_size(
                                            self.node.message_converter).size,
                                        is_actual_size=True),
                                    object_item_count=1,
                                    object_type=memory_utils.ObjectType.META,
                                    size_type=memory_utils.SizeType.SPECIAL)