parameters: (src_dir, compiler, include_dirs, iter_count)
return_statement: return result
docstring: Do the benchmarking
docstring_summary: Do the benchmarking
docstring_tokens: Do the benchmarking
function: def benchmark(src_dir, compiler, include_dirs, iter_count):
      """Do the benchmarking"""
  
      files = list(files_in_dir(src_dir, 'cpp'))
      random.shuffle(files)
      has_string_templates = True
      string_template_file_cnt = sum(1 for file in files if 'bmp' in file)
      file_count = len(files) + string_template_file_cnt
  
      started_at = time.time()
      result = {}
      for filename in files:
          progress = len(result)
          result[filename] = benchmark_file(
              os.path.join(src_dir, filename),
              compiler,
              include_dirs,
              (float(progress) / file_count, float(progress + 1) / file_count),
              iter_count
          )
          if 'bmp' in filename and has_string_templates:
              try:
                  temp_result = benchmark_file(
                      os.path.join(src_dir, filename),
                      compiler,
                      include_dirs,
                      (float(progress + 1) / file_count, float(progress + 2) / file_count),
                      iter_count,
                      '-Xclang -fstring-literal-templates'
                  )
                  result[filename.replace('bmp', 'slt')] = temp_result
              except:
                  has_string_templates = False
                  file_count -= string_template_file_cnt
                  print 'Stopping the benchmarking of string literal templates'
  
          elapsed = time.time() - started_at
          total = float(file_count * elapsed) / len(result)
          print 'Elapsed time: {0}, Remaining time: {1}'.format(
              format_time(elapsed),
              format_time(total - elapsed)
          )
      return result
function_tokens: def benchmark ( src_dir , compiler , include_dirs , iter_count ) : files = list ( files_in_dir ( src_dir , 'cpp' ) ) random . shuffle ( files ) has_string_templates = True string_template_file_cnt = sum ( 1 for file in files if 'bmp' in file ) file_count = len ( files ) + string_template_file_cnt started_at = time . time ( ) result = { } for filename in files : progress = len ( result ) result [ filename ] = benchmark_file ( os . path . join ( src_dir , filename ) , compiler , include_dirs , ( float ( progress ) / file_count , float ( progress + 1 ) / file_count ) , iter_count ) if 'bmp' in filename and has_string_templates : try : temp_result = benchmark_file ( os . path . join ( src_dir , filename ) , compiler , include_dirs , ( float ( progress + 1 ) / file_count , float ( progress + 2 ) / file_count ) , iter_count , '-Xclang -fstring-literal-templates' ) result [ filename . replace ( 'bmp' , 'slt' ) ] = temp_result except : has_string_templates = False file_count -= string_template_file_cnt print 'Stopping the benchmarking of string literal templates' elapsed = time . time ( ) - started_at total = float ( file_count * elapsed ) / len ( result ) print 'Elapsed time: {0}, Remaining time: {1}' . format ( format_time ( elapsed ) , format_time ( total - elapsed ) ) return result