@@ -37,6 +37,7 @@ def benchmarks(self) -> list[Benchmark]:
37
37
38
38
benches = [
39
39
GBench (self ),
40
+ GBenchUmfProxy (self ),
40
41
]
41
42
42
43
return benches
@@ -159,3 +160,57 @@ def parse_output(self, output):
159
160
raise ValueError (f"Error parsing output: { e } " )
160
161
161
162
return results
163
+
164
+
165
+ class GBenchPreloaded (GBench ):
166
+ def __init__ (self , bench ):
167
+ super ().__init__ (bench )
168
+
169
+ self .lib_to_be_replaced = None
170
+ self .replacing_lib = None
171
+
172
+ def bin_args (self ):
173
+ full_args = super ().bin_args ()
174
+ full_args .append ("--benchmark_filter=glibc" )
175
+
176
+ return full_args
177
+
178
+ def get_preloaded_name (self , pool_name ) -> str :
179
+ new_pool_name = pool_name .replace (self .lib_to_be_replaced , self .replacing_lib )
180
+
181
+ return new_pool_name
182
+
183
+ def parse_output (self , output ):
184
+ csv_file = io .StringIO (output )
185
+ reader = csv .reader (csv_file )
186
+
187
+ data_row = next (reader , None )
188
+ if data_row is None :
189
+ raise ValueError ("Benchmark output does not contain data." )
190
+
191
+ results = []
192
+ for row in reader :
193
+ try :
194
+ full_name = row [self .col_name ]
195
+ pool , config = self .get_pool_and_config (full_name )
196
+ mean = self .get_mean (row )
197
+ updated_pool = self .get_preloaded_name (pool )
198
+ updated_config = self .get_preloaded_name (config )
199
+
200
+ results .append ((updated_config , updated_pool , mean ))
201
+ except KeyError as e :
202
+ raise ValueError (f"Error parsing output: { e } " )
203
+
204
+ return results
205
+
206
+
207
+ class GBenchUmfProxy (GBenchPreloaded ):
208
+ def __init__ (self , bench ):
209
+ super ().__init__ (bench )
210
+
211
+ self .lib_to_be_replaced = "glibc"
212
+ self .replacing_lib = "umfProxy"
213
+
214
+ def extra_env_vars (self ) -> dict :
215
+ umf_proxy_path = os .path .join (options .umf , "lib" , "libumf_proxy.so" )
216
+ return {"LD_PRELOAD" : umf_proxy_path }
0 commit comments