KKimj / PerformanceFuzzer

PerformanceFuzzer
https://pypi.org/project/PerformanceFuzzer/
GNU General Public License v3.0
2 stars 0 forks source link

Final IR file #8

Closed KKimj closed 3 years ago

KKimj commented 3 years ago

class PerformanceFuzzer:

    def __init__(self, dirName, fileName = "main", testName = "0"):
        ## I added these variables.
        self.source = self.filePath
        self.target = self.filePath + testName

    def updateSource(self): 
        ## The command "cp" was used.
        os.system('cp '+self.target+'_opt.ll '+self.filePath+'_final.ll')
        os.system('cp '+self.target+' '+self.filePath+'_final')
        self.source = self.target

    def Run(self, isOriginal = False, isFinal = False):
        ## I added this branch
        start = time.time()
        if isOriginal:
            os.system(self.filePath+" 50000 --singlethreaded --printdigits")
        elif isFinal:
            os.system(self.filePath+"_final"+" 50000 --singlethreaded --printdigits")
        else:
            os.system(self.target+" 50000 --singlethreaded --printdigits")
        self.time_now = time.time() - start
        return self.time_now
KKimj commented 3 years ago
def tester_original(benchmark):
    # global performanceFuzzer
    performanceFuzzer = PerformanceFuzzer("cpubench", "cpubench")
    result = benchmark(performanceFuzzer.Run, isOriginal = True)
    assert result != 0

def tester_final(benchmark):
    # global performanceFuzzer
    performanceFuzzer = PerformanceFuzzer("cpubench", "cpubench")
    result = benchmark(performanceFuzzer.Run, isFinal = True)
    assert result != 0