@@ -37,6 +37,7 @@ def benchmarks(self) -> list[Benchmark]:
3737
3838 benches = [
3939 GBench (self ),
40+ GBenchUmfProxy (self ),
4041 ]
4142
4243 return benches
@@ -159,3 +160,54 @@ def parse_output(self, output):
159160 raise ValueError (f"Error parsing output: { e } " )
160161
161162 return results
163+
164+
165+ class GBenchPreloaded (GBench ):
166+ def __init__ (self , bench , lib_to_be_replaced , replacing_lib ):
167+ super ().__init__ (bench )
168+
169+ self .lib_to_be_replaced = lib_to_be_replaced
170+ self .replacing_lib = replacing_lib
171+
172+ def bin_args (self ):
173+ full_args = super ().bin_args ()
174+ full_args .append (f"--benchmark_filter={ self .lib_to_be_replaced } " )
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 , lib_to_be_replaced = "glibc" , replacing_lib = "umfProxy" )
210+
211+ def extra_env_vars (self ) -> dict :
212+ umf_proxy_path = os .path .join (options .umf , "lib" , "libumf_proxy.so" )
213+ return {"LD_PRELOAD" : umf_proxy_path }
0 commit comments