source: proto/SymbolTable/src/perf_script_wcd.py @ 1787

Last change on this file since 1787 was 1787, checked in by vla24, 8 years ago

Added a blank file for wcd. This file is used to measure fixed costs in various symtab impl.

File size: 1.6 KB
Line 
1from subprocess import *
2import os
3from string import *
4import run_wcd
5
6testfile_home = "../test/test_files/"
7programs = ['wcd']
8#TODO: Change the testfiles
9dictionaryfiles = ['test_dictionary.txt', 'test_dictionary.txt', 'test_dictionary.txt']
10testfiles = ['blank', 'test_text.txt', 'dict_bezier.txt']
11
12def run_test():     
13  mes_f = open('mesfile', 'w')
14  for program in programs:
15    for index in range(len(testfiles)):
16      dictionary_path = testfile_home+dictionaryfiles[index]
17      text_path = testfile_home+testfiles[index]
18      # convert files to lowercase
19      dictionary_new_path = run_wcd.convert_file_to_lowercase(dictionary_path)
20      text_new_path = run_wcd.convert_file_to_lowercase(text_path)
21      for i in range(10):
22        call(['./wcd', dictionary_new_path, text_new_path], stderr=mes_f)
23      run_wcd.delete_temporary_files(dictionary_new_path, text_new_path)
24
25def analyze_rslt():     
26      mes_f = open('mesfile', 'r')
27      results = mes_f.read().split(' ')
28      results_int = []
29      rows = {}
30      for r in results[:-1]:
31        results_int.append(int(r))
32      first_row = '\t'
33      for testfile in testfiles:
34        first_row += testfile + '  &\t'
35      first_row =  first_row[:-4]
36      print first_row
37      for program in programs:
38        row = program + '   \t&\t'
39        for testfile in testfiles:
40          result = results_int[0:10]
41          results_int = results_int[10:]
42          row +=  str(min(result)/1000.0) + '   &\t'
43        row = row[:-4]
44        row +='\\\\ \\hline'
45        print row
46       
47if __name__ == "__main__":
48  run_test()
49  analyze_rslt()
50 
51
52           
53       
54       
55       
56       
57       
58       
59       
60       
61       
62       
63       
64       
65       
66       
Note: See TracBrowser for help on using the repository browser.