Update MIPS Benchmark
This commit is contained in:
parent
6534605b6b
commit
0d1629e850
2 changed files with 11 additions and 11 deletions
|
@ -1,4 +1,3 @@
|
||||||
import numpy as np
|
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
class MIPSBenchmark:
|
class MIPSBenchmark:
|
||||||
|
@ -12,19 +11,20 @@ class MIPSBenchmark:
|
||||||
|
|
||||||
def ips_operation(self):
|
def ips_operation(self):
|
||||||
# Run basic 7 ALU operations
|
# Run basic 7 ALU operations
|
||||||
_ = np.random.randint(10) + np.random.randint(10)
|
_ = 5 + 5
|
||||||
_ = np.random.randint(10) - np.random.randint(10)
|
_ = 5 - 5
|
||||||
_ = np.random.randint(10) * np.random.randint(10)
|
_ = 5 * 5
|
||||||
_ = np.random.randint(10) // (np.random.randint(10) + 1) # Prevent Division by Zero
|
_ = 5 // 5
|
||||||
_ = np.random.choice([True, False]) & np.random.choice([True, False])
|
_ = True & True
|
||||||
_ = np.random.choice([True, False]) | np.random.choice([True, False])
|
_ = True | False
|
||||||
_ = np.random.choice([True, False]) ^ np.random.choice([True, False])
|
_ = False ^ False
|
||||||
|
|
||||||
def calculate(self):
|
def calculate(self):
|
||||||
self.elapsed_time = self.end_time - self.start_time
|
self.elapsed_time = self.end_time - self.start_time
|
||||||
self.total_instructions = self.iters*7
|
self.total_instructions = self.iters*7
|
||||||
self.mips = (self.total_instructions / self.elapsed_time) / 1000000
|
self.mips = (self.total_instructions / self.elapsed_time)
|
||||||
print(f"=> Executed {self.total_instructions} within {self.elapsed_time}\n=> Result : {self.mips:.2f} MIPS")
|
print(f"=> Executed {self.total_instructions} within {self.elapsed_time:.2f}")
|
||||||
|
print(f"=> Result : {self.mips:.2f} IPS / {self.mips/1e6:.2f} MIPS")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
print("# MIPS CPU Benchmark #")
|
print("# MIPS CPU Benchmark #")
|
||||||
|
|
|
@ -7,5 +7,5 @@ This repository contains useful programs written in **Python 3.9**. Each folder
|
||||||
* **Pickle Compress Program** : compress variable dumps using **gzip**, **bzip2**, **lzma**, or **no compression at all**
|
* **Pickle Compress Program** : compress variable dumps using **gzip**, **bzip2**, **lzma**, or **no compression at all**
|
||||||
* **FastAPI Simple Example** : contains API standard operations (Normal Request, GET Request, HTML Request)
|
* **FastAPI Simple Example** : contains API standard operations (Normal Request, GET Request, HTML Request)
|
||||||
* **Matrix-based Bencmark** : contains a class to recreate Linpack (Matrix-based) Floating-point Per Second (FLOPS) Benchmark. Based on **numpy** or **scipy** libs
|
* **Matrix-based Bencmark** : contains a class to recreate Linpack (Matrix-based) Floating-point Per Second (FLOPS) Benchmark. Based on **numpy** or **scipy** libs
|
||||||
* **MIPS-Benchmark** : contains a script to benchmark your CPU's Intrusion Execution Speed (Million Instructions Per Second). The result might be lower but consistent on numerous runs.
|
* **MIPS-Benchmark** : contains a script to benchmark your CPU's Execution Speed (Million Instructions Per Second). The result is often consistent
|
||||||
* *adding more soon*
|
* *adding more soon*
|
||||||
|
|
Loading…
Reference in a new issue