1515class AlloyAdapter (GaugeAdapter ):
1616 # To be sure about how to parse the output, give custom format
1717 # This avoids issues with perhaps none-standard /bin/usr/time
18- time_format = '"max rss (kb) : %M \n wall-time (secounds) : %e\n "'
19- re_formatted_time = re .compile (r"^wall-time \(secounds\) : (\d+\.\d+)" )
20- re_formatted_rss = re .compile (r"^max rss \(kb\) : (\d+)" )
18+ time_format = '"usr : %U \n wall-time: %e\n "'
19+ re_formatted_time = re .compile (r"^wall-time: (\d+\.\d+)" )
20+ re_formatted_usr = re .compile (r"^usr : (\d+\. \d+)" )
2121
2222 _completed_time_availability_check = False
2323 _use_formatted_time = False
@@ -30,12 +30,7 @@ def __init__(self, include_faulty, executor):
3030 GaugeAdapter .__init__ (self , include_faulty , executor )
3131
3232 def _create_command (self , command ):
33- if self ._use_formatted_time :
34- return "%s -f %s %s" % (self ._time_bin , AlloyAdapter .time_format , command )
35- else :
36- # use standard, but without info on memory
37- # TODO: add support for reading out memory info on OS X
38- return "/usr/bin/time -p %s" % command
33+ return "%s -f %s %s" % (self ._time_bin , AlloyAdapter .time_format , command )
3934
4035 def should_enable_premature_finalizer_optimization (self , run_id ):
4136 exec = run_id .benchmark .suite .executor .name
@@ -55,8 +50,11 @@ def should_enable_finalizer_elision(self, run_id):
5550 return "gcvs" in exec or "premopt" in exec or "elision-opt" in exec
5651
5752 def setup_stats (self , run_id ):
58- run_id .env ["ALLOY_LOG" ] = self .alloy_stats .name
59- run_id .env ["DISPLAY" ] = ":99"
53+ bm = run_id .benchmark .name .lower ()
54+ if "GC_LOG_DIR" in run_id .env :
55+ logdir = run_id .env ["GC_LOG_DIR" ]
56+ run_id .env ["GC_LOG_FILE" ] = f"{ logdir } -{ bm } .csv"
57+ # run_id.env["DISPLAY"] = ":99"
6058
6159 def acquire_command (self , run_id ):
6260 self .setup_stats (run_id )
@@ -100,60 +98,37 @@ def _check_which_time_command_is_available(self):
10098 AlloyAdapter ._time_bin = time_bin
10199 AlloyAdapter ._completed_time_availability_check = True
102100
103- def parse_stats (self , run_id , invocation , iteration , current ):
104- df = pd .read_csv (self .alloy_stats .name )
105- if df .empty :
106- print ("The file is empty (no data rows)." )
107- else :
108- stats = df .iloc [0 ]
109- assert (
110- self .should_enable_finalizer_elision (run_id ) == stats ["elision enabled" ]
111- )
112- assert (
113- self .should_enable_premature_finalizer_prevention (run_id )
114- == stats ["pfp enabled" ]
115- )
116- assert (
117- self .should_enable_premature_finalizer_optimization (run_id )
118- == stats ["premopt enabled" ]
119- )
120- stats = stats [3 :]
121- for idx , value in stats .items ():
122- measure = Measurement (
123- invocation ,
124- iteration ,
125- float (value ),
126- "stat" ,
127- run_id ,
128- idx ,
129- )
130- current .add_measurement (measure )
131-
132101 def parse_data (self , data , run_id , invocation ):
133102 iteration = 1
134103 data_points = []
135104 current = DataPoint (run_id )
105+ total_measure = None
136106
137107 for line in data .split ("\n " ):
138108 if self .check_for_error (line ):
139109 raise ResultsIndicatedAsInvalid (
140110 "Output of bench program indicated error."
141111 )
142112
143- if self ._use_formatted_time :
144- match = self .re_formatted_time .match (line )
145- if match :
146- self .parse_stats (run_id , invocation , iteration , current )
147- time = float (match .group (1 )) * 1000
148- measure = Measurement (
149- invocation , iteration , time , "ms" , run_id , "total"
150- )
151- current .add_measurement (measure )
152- data_points .append (current )
153- current = DataPoint (run_id )
154- iteration += 1
155- else :
156- raise NotImplementedError
113+ match1 = self .re_formatted_usr .match (line )
114+ match2 = self .re_formatted_time .match (line )
115+ if match1 :
116+ usr = float (match1 .group (1 )) * 1000
117+ measure = Measurement (invocation , iteration , usr , "ms" , run_id , "usr" )
118+ current .add_measurement (measure )
119+ elif match2 :
120+ time = float (match2 .group (1 )) * 1000
121+ measure = Measurement (
122+ invocation , iteration , time , "ms" , run_id , "total"
123+ )
124+ current .add_measurement (measure )
125+ data_points .append (current )
126+ current = DataPoint (run_id )
127+ iteration += 1
128+
129+ if total_measure :
130+ current .add_measurement (total_measure )
131+ data_points .append (current )
157132
158133 if not data_points :
159134 raise OutputNotParseable (data )
0 commit comments