source: proto/xmlschema/src/perf.py @ 3541

Last change on this file since 3541 was 3541, checked in by shiyangy, 6 years ago

perf script added

File size: 2.0 KB
Line 
1from subprocess import call, Popen
2import sys
3from collections import *
4import shiporder_gen
5
6outputpath = 'output'
7redirectoutput= ' 2>&1 | tee '+outputpath+'/output.txt >> perflog.txt'
8
9#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
11#n1 is the total byte of the file
12#n2 is the number of bytes of the doublelist data
13n1,n2 = shiporder_gen.gen(10000,11100,10,12)
14
15def execute(execution,count):
16        #parabix parsing only
17        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out > ../s.out']
18        p = Popen(cmd,shell=True)
19        p.wait()
20        #parsing and symbol table processing
21        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -s > ../s.out']
22        p = Popen(cmd,shell=True)
23        p.wait()
24        #parsing and symbol table processing and datatype validation
25        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -d > ../s.out']
26        p = Popen(cmd,shell=True)
27        p.wait()
28        #parsing and symbol table processing and content model validation
29        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -c > ../s.out']
30        p = Popen(cmd,shell=True)
31        p.wait()
32        #all
33        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -a > ../s.out']
34        p = Popen(cmd,shell=True)
35        p.wait()
36        #for datatype validation, without validation, just gathering
37        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -g > ../s.out']
38        p = Popen(cmd,shell=True)
39        p.wait()
40        #for content model validation, without validating
41        cmd = ['perf stat -e cycles,instructions -r ' +str(count) +' '+ './xmlwf ' + execution.file +' xml.out -v > ../s.out']
42        p = Popen(cmd,shell=True)
43        p.wait()
44       
45Execution = namedtuple('Execution',['file'])
46
47execution1 = Execution("shiporder_new.xml")
48
49execute(execution1,10)
50
51print n1
52print n2
53print float(n2)/n1
Note: See TracBrowser for help on using the repository browser.