Changeset 3546


Ignore:
Timestamp:
Oct 30, 2013, 2:55:48 PM (5 years ago)
Author:
shiyangy
Message:

script updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/xmlschema/src/perf.py

    r3545 r3546  
    44import shiporder_gen
    55
    6 outputpath = 'output'
    7 redirectoutput= ' 2>&1 | tee '+outputpath+'/output.txt >> perflog.txt'
    8 
    96#To generate a instance file, first two numbers is the range of the number of the element shiporder
    10 #the last two number is the range of the numbers of each doublelist data content
     7#the middle two number is the range of the numbers of each doublelist data content
    118#n1 is the total byte of the file
    129#n2 is the number of bytes of the doublelist data
    13 n1,n2 = shiporder_gen.gen(10000,11100,10,12,21,23)
     10n1,n2 = shiporder_gen.gen(1000,1100,0,1,200,203)
    1411
    1512perfin = open("perflog.txt",'r')
    1613perfout = open("st.txt",'w')
    1714
     15csv_ls = []
     16
    1817perfout.write('total byte:'+str(n1)+'\n')
     18csv_ls.append(n1)
    1919perfout.write('data byte:'+str(n2)+'\n')
     20csv_ls.append(n2)
    2021perfout.write('data percetage:'+str(float(n2)/n1)+'\n\n')
     22csv_ls.append(float(n2)/n1)
    2123
    2224def read_log(filename):
     
    5456def print_st(perfout,cy,ins):
    5557        perfout.write('cycles:'+str(cy)+'\n')
     58        csv_ls.append(cy)
    5659        perfout.write('instructions:'+str(ins)+'\n')
     60        csv_ls.append(ins)
    5761        perfout.write('cycles per byte:'+str(float(cy)/n1)+'\n')
     62        csv_ls.append(float(cy)/n1)
    5863        perfout.write('instructions per byte:'+str(float(ins)/n1)+'\n')
     64        csv_ls.append(float(ins)/n1)
    5965        perfout.write('\n\n')
    6066
     
    6470        p = Popen(cmd,shell=True)
    6571        p.wait()
    66         cy,ins = read_log("perflog.txt")
     72        cy_p,ins_p = read_log("perflog.txt")
    6773        perfout.write('parabix parsing only\n')
    68         print_st(perfout,cy,ins)
     74        print_st(perfout,cy_p,ins_p)
    6975        #parsing and symbol table processing
    7076        cmd = ['perf stat -o perflog.txt -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -s > ../s.out']
    7177        p = Popen(cmd,shell=True)
    7278        p.wait()
    73         cy,ins = read_log("perflog.txt")
     79        cy_s,ins_s = read_log("perflog.txt")
     80        cy = cy_s - cy_p
     81        ins = ins_s - ins_p
    7482        perfout.write('symbol table\n')
    7583        print_st(perfout,cy,ins)
     
    7987        p.wait()
    8088        cy,ins = read_log("perflog.txt")
     89        cy = cy - cy_s
     90        ins = ins - ins_s
    8191        perfout.write('datatype with symbol table\n')
    8292        print_st(perfout,cy,ins)
     
    8696        p.wait()
    8797        cy,ins = read_log("perflog.txt")
     98        cy = cy - cy_s
     99        ins = ins - ins_s
    88100        perfout.write('content model with symbol\n')
    89101        print_st(perfout,cy,ins)
     
    93105        p.wait()
    94106        cy,ins = read_log("perflog.txt")
     107        cy = cy - cy_s
     108        ins = ins - ins_s
    95109        perfout.write('all\n')
    96110        print_st(perfout,cy,ins)
     
    100114        p.wait()
    101115        cy,ins = read_log("perflog.txt")
     116        cy = cy - cy_s
     117        ins = ins - ins_s
    102118        perfout.write('datatype without validation, just gathering\n')
    103119        print_st(perfout,cy,ins)
     
    107123        p.wait()
    108124        cy,ins = read_log("perflog.txt")
     125        cy = cy - cy_s
     126        ins = ins - ins_s
    109127        perfout.write('content model without validation, just gathering\n')
    110128        print_st(perfout,cy,ins)
     
    128146                total_val += ls_ele[i]
    129147perfout.write('total number of element:'+str(total_ele)+'\n')
     148csv_ls.append(total_ele)
    130149perfout.write('total number of element validated:'+str(total_val)+'\n')
     150#csv_ls.append(total_val)
    131151perfout.write('element validated percetage:'+str(float(total_val)/total_ele)+'\n')
     152perfout.write('elements per kbytes'+str(float(total_ele*1000)/n1))
     153csv_ls.append(float(total_ele*1000)/n1)
    132154
     155csv_file = open('st.csv','a')
     156for i in csv_ls:
     157        csv_file.write(str(i))
     158        csv_file.write(',')
     159csv_file.write('\n')
    133160
    134 print n1
    135 print n2
    136 print float(n2)/n1
     161#print n1
     162#print n2
     163#print float(n2)/n1
Note: See TracChangeset for help on using the changeset viewer.