Skip to content

Commit

Permalink
toplev: Support new error handling in simple_ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
Andi Kleen committed Mar 25, 2015
1 parent 307b412 commit d431879
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions simple_ratios.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Simple 5 event top level model
#

print_error = lambda msg: False

# Constants

PipelineWidth = 4
Expand Down Expand Up @@ -95,36 +97,42 @@ class Metric_IPC:
name = "IPC"
desc = """
Instructions Per Cycle"""
errcount = 0

def compute(self, EV):
try:
self.val = IPC(EV, 0)
except ZeroDivisionError:
print "IPC zero division"
print_error("IPC zero division")
self.errcount += 1
self.val = 0

class Metric_UPI:
name = "UPI"
desc = """
Uops Per Instruction"""
errcount = 0

def compute(self, EV):
try:
self.val = UPI(EV, 0)
except ZeroDivisionError:
print "UPI zero division"
print_error("UPI zero division")
self.errcount += 1
self.val = 0

class Metric_TurboUtilization:
name = "TurboUtilization"
desc = """
Average Frequency Utilization relative nominal frequency"""
errcount = 0

def compute(self, EV):
try:
self.val = TurboUtilization(EV, 0)
except ZeroDivisionError:
print "TurboUtilization zero division"
print_error("TurboUtilization zero division")
self.errcount += 1
self.val = 0

class Setup:
Expand Down
1 change: 1 addition & 0 deletions toplev.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,7 @@ def ht_warning():
if detailed_model:
print >>sys.stderr, "Sorry, no detailed model for your CPU. Only Level 1 supported."
import simple_ratios
simple_ratios.print_error = pe
simple_ratios.Setup(runner)

def setup_with_metrics(p, runner):
Expand Down

0 comments on commit d431879

Please sign in to comment.