diff options
author | Ole Troan <ot@cisco.com> | 2018-07-18 20:31:48 +0200 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-07-19 12:17:22 +0000 |
commit | 2a7563b02496611653cc568c1db389c2e83d4052 (patch) | |
tree | 85509304292f2a87418908a2219e19d91cf8155a | |
parent | 22b3b846822df2701bb6cb508fa4e023526e5717 (diff) |
PAPI: Remove logging calls from pack/unpack
This slowed down the decoder. Improved from 16s to 13s for 1000 dump/details
messages.
Change-Id: Iae78136b020cdd9344f3b2170ce426d0f074b6e6
Signed-off-by: Ole Troan <ot@cisco.com>
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_serializer.py | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py index 7f5c5ace2dc..9b30d5caa56 100644 --- a/src/vpp-api/python/vpp_papi/vpp_serializer.py +++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py @@ -45,11 +45,9 @@ class BaseTypes(): .format(type, base_types[type])) def pack(self, data, kwargs=None): - logger.debug("Data: {} Format: {}".format(data, self.packer.format)) return self.packer.pack(data) def unpack(self, data, offset, result=None): - logger.debug("@ {} Format: {}".format(offset, self.packer.format)) return self.packer.unpack_from(data, offset)[0] @@ -72,8 +70,6 @@ class FixedList_u8(): def pack(self, list, kwargs): """Packs a fixed length bytestring. Left-pads with zeros if input data is too short.""" - logger.debug("Data: {}".format(list)) - if len(list) > self.num: raise ValueError('Fixed list length error for "{}", got: {}' ' expected: {}' @@ -95,8 +91,6 @@ class FixedList(): self.size = self.packer.size * num def pack(self, list, kwargs): - logger.debug("Data: {}".format(list)) - if len(list) != self.num: raise ValueError('Fixed list length error, got: {} expected: {}' .format(len(list), self.num)) @@ -123,7 +117,6 @@ class VLAList(): self.length_field = len_field_name def pack(self, list, kwargs=None): - logger.debug("Data: {}".format(list)) if len(list) != kwargs[self.length_field]: raise ValueError('Variable length error, got: {} expected: {}' .format(len(list), kwargs[self.length_field])) @@ -138,8 +131,6 @@ class VLAList(): return b def unpack(self, data, offset=0, result=None): - logger.debug("Data: {} @ {} Result: {}" - .format(list, offset, result[self.index])) # Return a list of arguments # u8 array @@ -164,8 +155,6 @@ class VLAList_legacy(): self.size = self.packer.size def pack(self, list, kwargs=None): - logger.debug("Data: {}".format(list)) - if self.packer.size == 1: return bytes(list) @@ -180,8 +169,6 @@ class VLAList_legacy(): raise ValueError('Legacy Variable Length Array length mismatch.') elements = int((len(data) - offset) / self.packer.size) r = [] - logger.debug("Legacy VLA: {} elements of size {}" - .format(elements, self.packer.size)) for e in range(elements): x = self.packer.unpack(data, offset) r.append(x) @@ -208,7 +195,6 @@ class VPPEnumType(): return self.enum[name] def pack(self, data, kwargs=None): - logger.debug("Data: {}".format(data)) return types['u32'].pack(data, kwargs) def unpack(self, data, offset=0, result=None): @@ -243,7 +229,6 @@ class VPPUnionType(): logger.debug('Adding union {}'.format(name)) def pack(self, data, kwargs=None): - logger.debug("Data: {}".format(data)) for k, v in data.items(): logger.debug("Key: {} Value: {}".format(k, v)) b = self.packers[k].pack(v, kwargs) @@ -312,12 +297,9 @@ class VPPType(): def pack(self, data, kwargs=None): if not kwargs: kwargs = data - logger.debug("Data: {}".format(data)) b = bytes() for i, a in enumerate(self.fields): if a not in data: - logger.debug("Argument {} not given, defaulting to 0" - .format(a)) b += b'\x00' * self.packers[i].size continue |