diff options
author | Mac Mollison <mollison@cs.unc.edu> | 2009-02-24 17:55:48 -0500 |
---|---|---|
committer | Mac Mollison <mollison@cs.unc.edu> | 2009-02-24 17:55:48 -0500 |
commit | ace5fe6fd1d7e25f2a213a1f5420142df85f55f4 (patch) | |
tree | 891f7de21f1bcdc22100274946fb2afb2ea3a499 | |
parent | 9fc7d10c40f19aea990dba776dd571d982da04e9 (diff) |
Fixed potential bug in the count function.
-rwxr-xr-x | sta.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -86,10 +86,11 @@ class Trace: | |||
86 | 86 | ||
87 | def print_count(self,verbose=False): | 87 | def print_count(self,verbose=False): |
88 | """Prints the number of records in the trace.""" | 88 | """Prints the number of records in the trace.""" |
89 | self.iter = list(self.iter) | ||
89 | print("Total Count: " + str(len(self.iter))) | 90 | print("Total Count: " + str(len(self.iter))) |
90 | if verbose: | 91 | if verbose: |
91 | counts = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0} | 92 | counts = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0} |
92 | for record in self.iter: | 93 | for record in list(self.iter): |
93 | type = record['type'] | 94 | type = record['type'] |
94 | counts[type] += 1 | 95 | counts[type] += 1 |
95 | for key in counts.keys(): | 96 | for key in counts.keys(): |