<commit_before>#!/usr/bin/python

## ======================================================================== ##
## Copyright 2009-2012 Intel Corporation                                    ##
##                                                                          ##
## Licensed under the Apache License, Version 2.0 (the "License");          ##
## you may not use this file except in compliance with the License.         ##
## You may obtain a copy of the License at                                  ##
##                                                                          ##
##     http://www.apache.org/licenses/LICENSE-2.0                           ##
##                                                                          ##
## Unless required by applicable law or agreed to in writing, software      ##
## distributed under the License is distributed on an "AS IS" BASIS,        ##
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
## See the License for the specific language governing permissions and      ##
## limitations under the License.                                           ##
## ======================================================================== ##

import sys
import os
import re

########################## configuration ##########################

dash = '/'
#models = [ 'conference' ]
#models = [ 'conference', 'sponza', 'headlight', 'crown']
models = [ 'conference', 'sponza', 'bentley', 'xyz_dragon', 'powerplant']
#models = [ 'conference', 'sponza', 'headlight', 'crown', 'bentley', 'xyz_dragon', 'powerplant' ]
#models = [ 'sophie', 'sophie_mblur']

arg = ''
modelDir  = ''
tutorial = 'tutorial03'
statDir = 'stat'
name = ''
if sys.platform == 'win32':
  modelDir = '%HOMEPATH%/models/embree/benchmarking'
else:
  modelDir = '~/models/embree/benchmarking'

########################## rendering ##########################

def baseName(name,model):
  return name + '_' + model

def render(name,model):
  executable = tutorial
  base = baseName(name,model)
  os.system('mkdir -p ' + statDir)
  logFile = statDir + dash + base + '.log'
  if not os.path.exists(logFile):
    command = executable
    command += ' -c ' + modelDir + dash + model + '_tutorial.ecs'
    for arg in args:
      command += ' ' + arg
    command += ' -rtcore verbose=2 -benchmark 4 16 > ' + logFile
    os.system(command)

def renderLoop():
    avgBase = baseName(name,'average')
    memory   [avgBase] = 0
    buildperf[avgBase] = 0
    sah      [avgBase] = 0
    fps_avg  [avgBase] = 0
    fps_sigma[avgBase] = 0
    fps_gain [avgBase] = 0
    printHeader()
    for model in models:
      sys.stdout.write('  ' + '{0:<35}'.format(model) + ' | ')
      render(name,model)
      extract(name,model,'')
      printData(name,model)

########################## data extraction ##########################

memory = {}
buildperf = {}
sah      = {}<commit_msg>fix in benchmark.py<commit_after>#!/usr/bin/python

## ======================================================================== ##
## Copyright 2009-2012 Intel Corporation                                    ##
##                                                                          ##
## Licensed under the Apache License, Version 2.0 (the "License");          ##
## you may not use this file except in compliance with the License.         ##
## You may obtain a copy of the License at                                  ##
##                                                                          ##
##     http://www.apache.org/licenses/LICENSE-2.0                           ##
##                                                                          ##
## Unless required by applicable law or agreed to in writing, software      ##
## distributed under the License is distributed on an "AS IS" BASIS,        ##
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
## See the License for the specific language governing permissions and      ##
## limitations under the License.                                           ##
## ======================================================================== ##

import sys
import os
import re

########################## configuration ##########################

dash = '/'
#models = [ 'conference' ]
#models = [ 'conference', 'sponza', 'headlight', 'crown']
models = [ 'conference', 'sponza', 'bentley', 'xyz_dragon', 'powerplant']
#models = [ 'conference', 'sponza', 'headlight', 'crown', 'bentley', 'xyz_dragon', 'powerplant' ]
#models = [ 'sophie', 'sophie_mblur']

arg = ''
modelDir  = ''
tutorial = 'tutorial03'
statDir = 'stat'
name = ''
if sys.platform == 'win32':
  modelDir = '%HOMEPATH%/models/embree/benchmarking'
else:
  modelDir = '~/models/embree/benchmarking'

########################## rendering ##########################

def baseName(name,model):
  return name + '_' + model

def render(name,model):
  executable = tutorial
  base = baseName(name,model)
  os.system('mkdir -p ' + statDir)
  logFile = statDir + dash + base + '.log'
  if not os.path.exists(logFile):
    command = executable
    command += ' -c ' + modelDir + dash + model + '_tutorial.ecs'
    for arg in args:
      command += ' ' + arg
    command += ' -rtcore verbose=2 -benchmark 4 16 > ' + logFile
    os.system(command)

def renderLoop():
    avgBase = baseName(name,'average')
    memory   [avgBase] = 0
    buildperf[avgBase] = 0
    sah      [avgBase] = 0
    fps_avg  [avgBase] = 0
    fps_sigma[avgBase] = 0
    fps_gain [avgBase] = 0
    printHeader()
    for model in models:
      sys.stdout.write('  ' + '{0:<55}'.format(model) + ' | ')
      render(name,model)
      extract(name,model,'')
      printData(name,model)

########################## data extraction ##########################

memory = {}
buildperf = {}
sah      = {}
{'fraction_non_alphanumeric': 0.22136222910216719, 'fraction_numerical': 0.009975920192638458, 'mean_word_length': 2.30773606370876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4186264', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1516, 'n_words': 422}