Skip to content

Commit

Permalink
Add a table.zero() function to bcc.TableBase
Browse files Browse the repository at this point in the history
It is sometimes useful to zero out the entries of table without erasing
the keys. Add a zero() function to make this easy.

Signed-off-by: Brenden Blanco <[email protected]>
  • Loading branch information
Brenden Blanco committed Feb 23, 2016
1 parent d1a0e7f commit 54797f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/python/bcc/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def clear(self):
for k in self.keys():
self.__delitem__(k)

def zero(self):
for k in self.keys():
self[k] = self.Leaf()

def __iter__(self):
return TableBase.Iter(self, self.Key)

Expand Down

0 comments on commit 54797f8

Please sign in to comment.