Project

General

Profile

« Previous | Next » 

Revision 1648

profiling.py ItersProfiler, exc.py ExPercentTracker: Only output fraction of rows with errors if self.iter_ct > 0, to avoid divide-by-zero error

View differences:

lib/profiling.py
35 35
    
36 36
    def msg(self):
37 37
        msg = Profiler.msg(self)
38
        if self.iter_ct != None:
38
        if self.iter_ct != None and self.iter_ct > 0:
39 39
            msg += ('/'+format.int2str(self.iter_ct)+' '+self.iter_text+'(s) = '
40 40
            +format.to_si(float(dates.total_seconds(self.total))/self.iter_ct)
41 41
            +'s/'+self.iter_text)
lib/exc.py
98 98
        if self.err_iter_ct != None:
99 99
            msg += ' in '+format.int2str(self.err_iter_ct)
100 100
            numerator = self.err_iter_ct
101
        if self.iter_ct != None:
101
        if self.iter_ct != None and self.iter_ct > 0:
102 102
            msg += ('/'+format.int2str(self.iter_ct)+' '+iter_text_plural+' = '
103 103
            +format.to_percent(float(numerator)/self.iter_ct))
104 104
        return msg

Also available in: Unified diff