Beispiel #1
0
def main():

    benchmark_dir = os.path.join(os.getcwd(), 'results')
    os.makedirs(benchmark_dir)

    pull_request_id = os.environ.get('PULL_REQUEST_NUMBER')
    commit_hash = get_commit_hash()  #[:8]
    info = BenchmarksInfo(pull_request_id, commit_hash)
    info.datetime.append(datatime_with_format())  #start time

    print(f'pull_request_id = {pull_request_id}')
    print(f'commit_hash = {commit_hash}')

    for arch in benchmark_archs:
        #init & run
        suites = BenchmarkSuites(arch)
        suites.run()
        #save result
        suites.save(benchmark_dir)
        #add benchmark info
        info.add_suites_info(arch, suites)

    info.datetime.append(datatime_with_format())  #end time
    #save commit and benchmark info
    info_path = os.path.join(benchmark_dir, '_info.json')
    info_str = dump2json(info)
    with open(info_path, 'w') as f:
        print(info_str, file=f)
Beispiel #2
0
 def save_as_markdown(self, arch_dir='./'):
     current_time = datatime_with_format()
     commit_hash = get_commit_hash()  #[:8]
     file_name = f'{self.suite_name}.md'
     file_path = os.path.join(arch_dir, file_name)
     with open(file_path, 'w') as f:
         lines = [
             f'commit_hash: {commit_hash}\n', f'datatime: {current_time}\n'
         ]
         lines += self._get_markdown_lines()
         for line in lines:
             print(line, file=f)
Beispiel #3
0
 def __init__(self):
     """init with commit info"""
     self.commit_hash = ti_core.get_commit_hash()
     self.datetime = datatime_with_format()
     self.suites = {}
     print(f'commit_hash = {self.commit_hash}')