Update MIPS Benchmark

This commit is contained in:
Alauddin Maulana Hirzan 2024-06-18 04:02:17 +07:00
parent 6534605b6b
commit 0d1629e850
Signed by: maulanahirzan
GPG key ID: 484DAC952787FA13
2 changed files with 11 additions and 11 deletions

View file

@ -1,4 +1,3 @@
import numpy as np
from time import time
class MIPSBenchmark:
@ -12,19 +11,20 @@ class MIPSBenchmark:
def ips_operation(self):
# Run basic 7 ALU operations
_ = np.random.randint(10) + np.random.randint(10)
_ = np.random.randint(10) - np.random.randint(10)
_ = np.random.randint(10) * np.random.randint(10)
_ = np.random.randint(10) // (np.random.randint(10) + 1) # Prevent Division by Zero
_ = np.random.choice([True, False]) & np.random.choice([True, False])
_ = np.random.choice([True, False]) | np.random.choice([True, False])
_ = np.random.choice([True, False]) ^ np.random.choice([True, False])
_ = 5 + 5
_ = 5 - 5
_ = 5 * 5
_ = 5 // 5
_ = True & True
_ = True | False
_ = False ^ False
def calculate(self):
self.elapsed_time = self.end_time - self.start_time
self.total_instructions = self.iters*7
self.mips = (self.total_instructions / self.elapsed_time) / 1000000
print(f"=> Executed {self.total_instructions} within {self.elapsed_time}\n=> Result : {self.mips:.2f} MIPS")
self.mips = (self.total_instructions / self.elapsed_time)
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):
print("# MIPS CPU Benchmark #")

View file

@ -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**
* **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
* **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*