예제 #1
0
def main():
  if len(sys.argv) < 2:
    print 'Usage: %s [url]' % (sys.argv[0])
    exit(-1)
  
  url_match = re.match('^(.*)\/view\/(\d+)$', sys.argv[1])
  if url_match is None:
    print 'Error: Bad URL argument. Exiting.'
    exit(-1)
  
  url = '%s/show/%s.geekbench' % (url_match.group(1), url_match.group(2))  
  data = urllib.urlopen(url).read()
  document = geekbench.parse_document(data)
  
  sections = ['Integer', 'Floating Point', 'Memory', 'Stream']
  section_weights = { 'Integer' : 0.35, 'Floating Point' : 0.35, 'Memory' : 0.2, 'Stream' : 0.1 }
  section_scores = {}
  
  # Iterate through the sections in this document.
  for section in document.sections:
    scores = []
    for workload in section.workloads:
      for result in workload.results:
        if result.threads == 1:
          scores.append(int(result.score))
    section_scores[section.name] = sum(scores, 0) / len(scores)

  geekbench_score = 0
  for section in sections:
    section_title = '%s Performance:' % (section,)
    print '%-30s %5d' % (section_title, section_scores[section])
    geekbench_score += section_weights[section] * section_scores[section]
  print '\nGeekbench Score:               %5d' % (int(geekbench_score),)
예제 #2
0
def main():
  if len(sys.argv) < 2:
    print 'Usage: %s [filename]' % (sys.argv[0])
    exit(-1)
  
  document = geekbench.parse_document(open(sys.argv[1]).read())
  
  singlecore_scores = []
  multicore_scores = []
  
  # Iterate through the sections in this document.
  for section in document.sections:

    # Since we're calculating the processors's single-core and multi-core
    # performance, only gather scores from the integer and floating point
    # sections (and skip the memory sections).
    if section.id not in ['1', '2']:
      continue

    for workload in section.workloads:
      for result in workload.results:
        if result.threads == 1:
          singlecore_scores.append(int(result.score))
        else:
          multicore_scores.append(int(result.score))

  print 'Geekbench Score:   %7d' % (int(document.score), )
  print 'Single-Core Score: %7d' % (sum(singlecore_scores, 0) / len(singlecore_scores), )
  print 'Multi-Core Score:  %7d' % (sum(multicore_scores, 0) / len(multicore_scores), )
def main():
  document = geekbench.parse_document(open(sys.argv[1], 'rt').read())  
  
  # Display system information by iterating through the system information
  # metrics.
  
  for metric in document.metrics:
    print '  %-25s %s' % (metric.name, metric.value)
  print '\n'
  
  # Iterate through the sections in this document.
  for section in document.sections:
    print '%s Performance' % (section.name,)
    
    # Iterate through the workloads in this section.
    for workload in section.workloads:
      print '  ', workload.name
      
      # Iterate through the individual results in this workload.
      for result in workload.results:
        print '    ',

        # Display whether the workload was run in single-threaded or 
        # multi-threaded mode.
        if result.threads == 1:
          print 'single-threaded',
        else:
          print 'multi-threaded',

        # Display whether the workload contains scalar or vector 
        # (i.e., SIMDized) code.
        if result.simd == 0:
          print 'scalar',
        else:
          print 'vector',
          
        print result.score
    print '\n',
    
  # Display the overall score.
  print 'Geekbench 2 Score: ', document.score
def main():
  xml = urllib2.urlopen('%s.geekbench' % (sys.argv[1],)).read()
  document = geekbench.parse_document(xml)
  
  for section in document.sections:
    scores = []
    for workload in section.workloads:
      if skip_workload(workload):
        continue
      for result in workload.results:
        scores.append(result.score)
    print scores
    section.score = sum(scores) / len(scores)

  weights = {
    1: 0.35,
    2: 0.35,
    3: 0.20,
    4: 0.10
  }
  document.score = 0
  for section in document.sections:
    document.score += int(section.score * weights[section.id])

  # Display system information by iterating through the system information
  # metrics.

  for metric in document.metrics:
    print '  %-25s %s' % (metric.name, metric.value)
  print '\n'
  
  # Iterate through the sections in this document.
  for section in document.sections:
    print '%s Performance' % (section.name,)
    
    # Iterate through the workloads in this section.
    for workload in section.workloads:
      if skip_workload(workload):
        continue
      print '  ', workload.name
      
      # Iterate through the individual results in this workload.
      for result in workload.results:
        print '    ',

        # Display whether the workload was run in single-threaded or 
        # multi-threaded mode.
        if result.threads == 1:
          print 'single-threaded',
        else:
          print 'multi-threaded',

        # Display whether the workload contains scalar or vector 
        # (i.e., SIMDized) code.
        if result.simd == 0:
          print 'scalar',
        else:
          print 'vector',
          
        print result.score
    print '\n',
    
  # Display the overall score.
  print 'Geekbench 2 Score: ', document.score