Skip to content

Commit

Permalink
Inject numcores into the perf index calculation, and lintify.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiceatscion committed Mar 28, 2024
1 parent c6b8538 commit be03821
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions acceptance/router_benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def horsepower(self) -> tuple[int]:

return round(hp["coremark"]), round(hp["mmbm"])

def perfIndex(self, rate: int, coremark:int, mmbm: int) -> float:
def perfIndex(self, rate: int, numcores: int, coremark: int, mmbm: int) -> float:
# mmbm is in mebiBytes/s
return 1.0 / (coremark_sum * (1.0/rate - BM_PACKET_LEN / (mmbm * 1024 * 1024)))
return 1.0 / (coremark_sum * numcores * (1.0/rate - BM_PACKET_LEN / (mmbm * 1024 * 1024)))

def run(self):
print("Benchmarking...")
Expand Down Expand Up @@ -392,7 +392,7 @@ def run(self):
for tt in TEST_CASES:
# TODO(jiceatscion): The perf index assumes that line speed isn't the bottleneck.
# It almost never is, but ideally we'd need to run iperf3 to verify.
print(f"Perf index for {tt}: {self.perfIndex(rateMap[tt], coremark, mmbm)}")
print(f"Perf index for {tt}: {self.perfIndex(rateMap[tt], cores, coremark, mmbm)}")

# Check the saturation...
# Make sure that the saturation is within the expeected ballpark: that should manifest as
Expand Down
7 changes: 4 additions & 3 deletions acceptance/router_benchmark/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,9 @@ def horsepower(self) -> tuple[int]:

return round(coremark), round(mmbm)

def perfIndex(self, rate: int, coremark:int, mmbm: int) -> float:
def perfIndex(self, rate: int, numcores: int, coremark: int, mmbm: int) -> float:
# mmbm is in mebiBytes/s
return 1.0 / (coremark * (1.0/rate - BM_PACKET_LEN / (mmbm * 1024 * 1024)))
return 1.0 / (coremark * numcores * (1.0/rate - BM_PACKET_LEN / (mmbm * 1024 * 1024)))

def _run(self):
coremark, mmbm = self.horsepower()
Expand Down Expand Up @@ -599,7 +599,8 @@ def _run(self):
for tt in TEST_CASES:
# TODO(jiceatscion): The perf index assumes that line speed isn't the bottleneck.
# It almost never is, but ideally we'd need to run iperf3 to verify.
logger.info(f"Perf index for {tt}: {self.perfIndex(rateMap[tt], coremark, mmbm)}")
logger.info(
f"Perf index for {tt}: {self.perfIndex(rateMap[tt], cores, coremark, mmbm)}")

# Log and check the performance...
# If this is used as a CI test. Make sure that the performance is within the expected
Expand Down

0 comments on commit be03821

Please sign in to comment.