diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-11-20 23:42:53 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-11-20 23:42:53 -0500 |
commit | a1023184126e79b14ceceb3fa7a93f6f4a21b10e (patch) | |
tree | dad16d8473c78c8ace6b4c4c8094a560c88a02b5 /util | |
parent | 67c276ed2ea254ec5b3df1853d0a92c053e95879 (diff) | |
download | gem5-a1023184126e79b14ceceb3fa7a93f6f4a21b10e.tar.xz |
Deal with divide by zero in the python stats stuff.
util/stats/info.py:
If an operation results in a divide by zero, just return None
--HG--
extra : convert_revision : 19cb4319734a3a9cf02bb1966fed42eb0c8a8ade
Diffstat (limited to 'util')
-rw-r--r-- | util/stats/info.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util/stats/info.py b/util/stats/info.py index 7c03a34fa..1f9f11940 100644 --- a/util/stats/info.py +++ b/util/stats/info.py @@ -254,7 +254,10 @@ class BinaryProxy(ValueProxy): val1 = value(self.arg1, run) if val0 is None or val1 is None: return None - return self.op(val0, val1) + try: + return self.op(val0, val1) + except ZeroDivisionError: + return None def __vectorvalue__(self, run, index): if scalar(self.arg0): @@ -269,7 +272,10 @@ class BinaryProxy(ValueProxy): if val0 is None or val1 is None: return None - return self.op(val0, val1) + try: + return self.op(val0, val1) + except ZeroDivisionError: + return None def __vectorlen__(self): if vector(self.arg0) and scalar(self.arg1): |