Closed KKimj closed 3 years ago
class PerformanceFuzzer:
def __init__(self, dirName, fileName = "main", testName = "0", _warmup = 2, _round = 8, _cpubench_arg = 50000):
## I added new parameters, _warmup, _round, _cpubench_arg
self.warmup = _warmup
self.round = _round
self.cpubench_arg = " "+str(_cpubench_arg) + " --singlethreaded --printdigits"
self.time = BenchmarkTime()
## I added new Method
def BenchmarkSetup(self, _warmup, _round, _cpubench_arg):
self.warmup = _warmup
self.round = _round
self.cpubench_arg = " "+str(_cpubench_arg) + " --singlethreaded --printdigits"
## I added new parameters, _warmup, _round, _cpubench_arg
def main(filename_list, _warmup, _round, _cpubench_arg):
if len(filename_list) == 1:
performanceFuzzer = PerformanceFuzzer(filename_list[0])
elif len(filename_list) == 2:
performanceFuzzer = PerformanceFuzzer(filename_list[0], filename_list[1])
performanceFuzzer.BenchmarkSetup(_warmup, _round, _cpubench_arg)
performanceFuzzer.Insert()
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument(nargs='+' ,help='Example) index.html', dest='filename')
## I added new parsing options, _warmup, _round, _cpubench_arg
parser.add_argument('--warmup', '-w', nargs=None, type=int , default = 1, help='warmup before benchmark')
parser.add_argument('--round', '-r', nargs=None, type=int, default = 4, help='number of running test')
parser.add_argument('--cpubench', '-cpu', nargs=None, type=int, default = 50000, help='argument for cpubench')
filename_list = parser.parse_args().filename
_warmup = parser.parse_args().warmup
_round = parser.parse_args().round
_cpubench_arg = parser.parse_args().cpubench
return filename_list, _warmup, _round, _cpubench_arg
if __name__ == '__main__':
filename_list, _warmup, _round, _cpubench_arg = get_arguments()
main(filename_list, _warmup, _round, _cpubench_arg)
(benchmark) round와 warmup을 옵션으로 지정하는 것을 구현한다.