import os
import sys
bench_math = ['acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'cbrt', 'cos', 'cosf', 'cosh', 'erf', 'erfc', 'exp', 'exp10', 'exp10f', 'exp2', 'exp2f', 'expf', 'expm1', 'fmax', 'fmaxf', 'fmin', 'fminf', 'hypot', 'hypotf', 'ilogb', 'ilogbf', 'isfinite', 'isinf', 'isnan', 'j0', 'j1', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'log2f', 'logb', 'logbf', 'logf', 'modf', 'pow', 'powf', 'rint', 'roundeven', 'roundevenf', 'sin', 'sincos', 'sincosf', 'sinf', 'sinh', 'sqrt', 'tan', 'tanh', 'tgamma', 'trunc', 'truncf', 'y0', 'y1', 'cbrtl']
bench_pthread = ['pthread_once', 'thread_create']
bench_string = ['ffs', 'ffsll']
stdio_common_benchset = ['sprintf']
scriptPath = "scripts/bench.py"
os.chdir("benchtests")
def main(args):
if args == "bench-math":
benchcase = bench_math
if args == "bench-pthread":
benchcase = bench_pthread
if args == "bench-string":
benchcase = bench_string
if args == "stdio-common-benchset":
benchcase = stdio_common_benchset
for i in range(0, len(benchcase)):
outputFile = args + "-" + benchcase[i]+".c"
cmd ="python " + scriptPath + " " + benchcase[i] + " " + "> " + outputFile
os.system(cmd)
return os.EX_OK
if __name__ == "__main__":
sys.exit(main(sys.argv[1]))