source: trunk/lib_ir/u8u16/perf_script.py @ 4044

Last change on this file since 4044 was 4044, checked in by linmengl, 5 years ago

add script to measure u8u16 performance. add cmake target to run the perf script

File size: 866 bytes
Line 
1import os
2import re
3import csv
4import subprocess
5
6RUNS = 3
7
8testfile_home = "../../../trunk/QA/TD/"
9testfiles = ['dew.xml','jaw.xml','roads-2.gml','po.xml','soap.xml']
10
11program = 'u8u16'
12perf_items = ['cycles', 'instructions']
13
14res = {}
15for testfile in testfiles:
16    out_comm = 'perf stat -x, -r '+str(RUNS)+' -o perfout' + ' ./' + program + ' ' + testfile_home + testfile + ' /dev/null'
17
18    subprocess.call(out_comm, shell=True)
19    res[testfile] = {}
20    with open('perfout', 'rb') as f:
21        reader = csv.reader(f)
22        for row in reader:
23            if len(row) == 3:
24                res[testfile][row[1]] = row[0]
25
26row_format = "{:>15}" * (len(testfiles) + 1)
27print row_format.format("", *testfiles)
28
29for item in perf_items:
30    collect = [int(res[testfile][item]) / 10000 / 100.0 for testfile in testfiles]
31    print row_format.format(item, *collect)
32
Note: See TracBrowser for help on using the repository browser.