33import csv
44import argparse
55import yaml
6- import glob
6+ import glob , os
77from collections import defaultdict
88
99METRICS_FILE = "metrics.yaml"
@@ -25,6 +25,8 @@ def read_brunchstat_from_log(log_file_name):
2525 # remove _unsat_test
2626 cur_test = test_name [:- 12 ]
2727 new_test_data ['job_name' ] = cur_test
28+ new_test_data ['pp_loc' ] = get_loc_info (cur_test , True )
29+ new_test_data ['opsem_loc' ] = get_loc_info (cur_test , False )
2830 data .append (new_test_data )
2931 elif line .startswith ("BRUNCH_STAT" ):
3032 stat = line .split ()
@@ -37,6 +39,27 @@ def read_brunchstat_from_log(log_file_name):
3739 log_file .close ()
3840 return data
3941
42+ def get_loc_info (file_name , is_pp ):
43+ # Directory where the files are located
44+ directory_path = "/tmp/verify-c-common/"
45+
46+ ir_name = f"{ file_name } .ir.peel.fat.pp.ms.bc" if is_pp else f"{ file_name } .ir.peel.fat.pp.ms.crab.o.ul.cut.o.bc"
47+
48+ # Construct the full path to the file with its pattern
49+ full_path = os .path .join (directory_path , ir_name )
50+
51+ # Get the LOC of the file
52+ LOC = 'n/a'
53+ with open (full_path , 'r' ) as file :
54+ lines = file .readlines ()
55+ start = False
56+ for line in lines :
57+ if start :
58+ LOC += 1
59+ if '@main' in line :
60+ LOC = 0
61+ start = True
62+ return LOC
4063
4164def read_symbiotic_bruchstat_from_log (log_file_name , xml_file_dir , time_out ):
4265 log_file = open (log_file_name , 'r' )
@@ -115,6 +138,7 @@ def write_brunchstat_into_csv(data, out_file):
115138 for job_data in data :
116139 row = (job_data [k ] for k , _ in metric_serlz )
117140 writer .writerow (row )
141+ print (f'[Statistics] Please find stat csv file at { out_file } ' )
118142
119143
120144# def read_timimg_results(result_dir):
0 commit comments