Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # this made for python3
- import os
- import subprocess as sp
- class RunTest:
- """ """
- DEBUG = False
- MAXTry = 100
- def do(self):
- structDic = eval("{" + self.doStructLoop() + "}")
- for x in range(0, self.MAXTry):
- self.mapReduce(structDic, "{" + self.doStructLoop() + "}")
- self.printResult("StructTrials", structDic)
- def doStructLoop(self):
- return sp.check_output("./aStruct.out", shell=True, universal_newlines=True)
- def mapReduce(self, baseDic, dicStr):
- newDic = eval(dicStr)
- self.DebugPrint(newDic)
- for key, val in newDic.items():
- baseDic[key] += val
- def printResult(self, signiture, dic):
- print(signiture)
- for key, val in dic.items():
- print("%s : av = %f, total = %f" % (key, val/self.MAXTry, val))
- @staticmethod
- def DebugPrint(str):
- if RunTest.DEBUG:
- print(str)
- else:
- pass
- if __name__ == "__main__":
- os.system('swiftc -sdk $(xcrun --show-sdk-path --sdk macosx) -o aStruct.out for-inExp-struct.swift')
- print("no Optimize")
- ins = RunTest()
- ins.do()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement