Index: trunk/udpprofile/web/report.py |
— | — | @@ -168,20 +168,25 @@ |
169 | 169 | onereal=event["onereal"] |
170 | 170 | |
171 | 171 | if old: |
172 | | - oldcount=float(old["count"])/oldtotal["count"] |
173 | | - countdiff = (callcount-oldcount)/oldcount |
| 172 | + try: |
| 173 | + oldcount=float(old["count"])/oldtotal["count"] |
| 174 | + countdiff = (callcount-oldcount)/oldcount |
174 | 175 | |
175 | | - oldcpupct = old["cpu"]/oldtotal["cpu"] |
176 | | - cpupctdiff = (cpupct-oldcpupct)/oldcpupct |
| 176 | + oldcpupct = old["cpu"]/oldtotal["cpu"] |
| 177 | + cpupctdiff = (cpupct-oldcpupct)/oldcpupct |
177 | 178 | |
178 | | - onecpudiff = ( onecpu - old["onecpu"] ) / old["onecpu"] |
| 179 | + onecpudiff = ( onecpu - old["onecpu"] ) / old["onecpu"] |
179 | 180 | |
180 | | - oldrealpct = old["real"]/oldtotal["real"] |
181 | | - realpctdiff = (realpct-oldrealpct)/oldrealpct |
| 181 | + oldrealpct = old["real"]/oldtotal["real"] |
| 182 | + realpctdiff = (realpct-oldrealpct)/oldrealpct |
182 | 183 | |
183 | | - o=old["onereal"] |
184 | | - onerealdiff = ( onereal - old["onereal"] ) / old["onereal"] |
185 | | - |
| 184 | + onerealdiff = ( onereal - old["onereal"] ) / old["onereal"] |
| 185 | + except ZeroDivisionError: |
| 186 | + countdiff=0 |
| 187 | + cpupctdiff=0 |
| 188 | + onecpudiff=0 |
| 189 | + realpctdiff=0 |
| 190 | + onerealdiff=0 |
186 | 191 | else: |
187 | 192 | countdiff=0 |
188 | 193 | cpupctdiff=0 |