Changeset 3342 for proto/RE/performance


Ignore:
Timestamp:
Jun 21, 2013, 10:58:17 AM (6 years ago)
Author:
bhull
Message:

RE perf script changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/performance/perf.py

    r3272 r3342  
    55import os.path
    66import sys
     7import shutil
    78
    89def execute(execution):
     
    2526
    2627        #quick version
     28        outputpath = 'output/'+execution.file.description+'/'+execution.expression.description+'/'+execution.program
     29        if not os.path.exists(outputpath):
     30                os.makedirs(outputpath)
    2731        one=execute_one(execution,1)
     32        results_file = open(outputpath+'/'+execution.stat,'w')
     33        results_file.write(str(one))
     34        results_file.close()
    2835        return one,one,one,one
    2936
     
    4350
    4451def execute_one(execution, count):
     52        outputpath = 'output/'+execution.file.description+'/'+execution.expression.description+'/'+execution.program
    4553        log_file = open('perflog.txt', 'a')
    4654        log_file.write('\nEXECUTION: '+execution.file.description+' '+ execution.expression.description+' '+ execution.program+' '+ execution.stat+'\n')
    4755        log_file.close()
    48         redirectoutput= ' >> perflog.txt 2>&1'
     56        redirectoutput= ' 2>&1 | tee '+outputpath+'/output.txt >> perflog.txt'
    4957        if execution.program=='bitstreams':
    5058               
     
    5664                call('make -C '+re_home+'output/' + redirectoutput,shell=True)
    5765                call('make -C '+re_home+'output/src/' + redirectoutput,shell=True)
    58                
     66                shutil.copyfile(re_home+'output/re_pablo_cc.py', outputpath+'/re_pablo_cc.py')
    5967                cmd = ['perf stat -x, -o perfoutput -r '+str(count)+' -e '+ execution.stat+ ' '+re_home+'output/src/re '+ execution.file.file + redirectoutput]
    6068                p = Popen(cmd,shell=True)
     
    97105
    98106#http://sljit.sourceforge.net/regex_perf.html
    99 files.append(File('data/mark.txt','data/mark.txt',('regex_perf',)))
     107files.append(File('data/mark.txt','mark_twain',('regex_perf',)))
    100108expressions.append(Expression('Twain', 'Twain', ('regex_perf',)))
    101109expressions.append(Expression('^Twain', '^Twain', ('regex_perf',)))
     
    122130#http://lh3lh3.users.sourceforge.net/reb.shtml
    123131files.append(File('data/howto','howto',('reb',)))
    124 expressions.append(Expression('([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?', '([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?', ('reb',)))
    125 expressions.append(Expression('([^ @]+)@([^ @]+)', '([^ @]+)@([^ @]+)', ('reb',)))
    126 expressions.append(Expression('([0-9][0-9]?)/([0-9][0-9]?)/([0-9][0-9]([0-9][0-9])?)', '([0-9][0-9]?)/([0-9][0-9]?)/([0-9][0-9]([0-9][0-9])?)', ('reb',)))
    127 expressions.append(Expression('([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)', '([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)', ('reb',)))
     132expressions.append(Expression('([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?', 'URI', ('reb',)))
     133expressions.append(Expression('([^ @]+)@([^ @]+)', 'Email', ('reb',)))
     134expressions.append(Expression('([0-9][0-9]?)/([0-9][0-9]?)/([0-9][0-9]([0-9][0-9])?)', 'Date', ('reb',)))
     135expressions.append(Expression('([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)', 'URIorEmail', ('reb',)))
    128136
    129137
Note: See TracChangeset for help on using the changeset viewer.