3131
3232patch_path = (tilt_locks_dir / "prefetch.diff" ).resolve ()
3333
34+
3435def build_locks (platform : Platform ) -> Tuple [Path , Path ]:
3536 """
36- Build different versions of Vsync locks, including the normal version and the regression version.
37-
37+ Build different versions of Vsync locks, including the normal and the regression version.
38+
3839 :param platform: Current platform object
3940 :return: Returns two paths: normal version and regression version (not used in this test)
4041 """
41-
42+
4243 # Create TiltLib instance to build the normal version of the tilt lock
4344 tilt_ok = TiltLib (tilt_locks_dir = tilt_locks_dir , build_prefix = "build_ok" )
44-
45-
45+
4646 platform .comm .shell (
4747 command = "git checkout -- include/vsync/atomic/internal/arm64.h" ,
4848 current_dir = vsync_dir ,
4949 )
50- tilt_ok .build ()
51- build_ok = tilt_ok .build_dir
50+ tilt_ok .build ()
51+ build_ok = tilt_ok .build_dir
5252
53-
5453 tilt_reg = TiltLib (tilt_locks_dir = tilt_locks_dir , build_prefix = "build_reg" )
55-
56-
54+
5755 platform .comm .shell (command = f"git apply { patch_path } " , current_dir = vsync_dir )
58- tilt_reg .build ()
59- build_regression = tilt_reg .build_dir
56+ tilt_reg .build ()
57+ build_regression = tilt_reg .build_dir
6058
6159 # Return the two build directories
6260 return build_ok , build_regression
@@ -68,7 +66,7 @@ def get_campaign(
6866) -> CampaignCartesianProduct :
6967 """
7068 Create a benchmark campaign specifying shared libraries and the type of lock.
71-
69+
7270 :param shared_libs: Shared libraries to use
7371 :param mutex_constant: Lock type constant
7472 :return: Returns a campaign instance
@@ -82,13 +80,14 @@ def get_campaign(
8280 test_name = [], # Test name is empty, meaning a custom benchmark
8381 shared_libs = shared_libs , # Set shared libraries
8482 constants = {
85- "mutex" : mutex_constant ,
83+ "mutex" : mutex_constant ,
8684 },
87- nb_runs = 3 ,
88- benchmark_duration_seconds = 10 ,
89- nb_threads = [1 , 2 , 4 , 8 , 16 , 32 , 64 ],
85+ nb_runs = 3 ,
86+ benchmark_duration_seconds = 10 ,
87+ nb_threads = [1 , 2 , 4 , 8 , 16 , 32 , 64 ],
9088 )
9189
90+
9291def get_baseline_campaign () -> CampaignCartesianProduct :
9392 return get_campaign (
9493 mutex_constant = "pthread_mutex" ,
@@ -143,14 +142,14 @@ def get_vcaslock_lse_prefetch_campaign(build_path: Path) -> CampaignCartesianPro
143142 shared_libs = [PrecompiledSharedLib (path = vcaslocklib_path , env_vars = None )],
144143 )
145144
145+
146146def main () -> None :
147147 platform = get_current_platform ()
148- hostname = platform .hostname
149-
148+ hostname = platform .hostname
149+
150150 # Build normal and regression versions of the tilt lock
151151 build_ok , build_regression = build_locks (platform = platform )
152-
153-
152+
154153 campaigns = [
155154 get_baseline_campaign (),
156155 get_taslock_campaign (build_path = build_ok ),
@@ -160,38 +159,35 @@ def main() -> None:
160159 get_vcaslock_nolse_prefetch_campaign (build_path = build_regression ),
161160 get_vcaslock_lse_prefetch_campaign (build_path = build_regression ),
162161 ]
163-
164-
162+
165163 suite = CampaignSuite (campaigns = campaigns )
166- suite .print_durations ()
167- suite .run_suite ()
164+ suite .print_durations ()
165+ suite .run_suite ()
168166
169-
170167 suite .generate_global_csv ()
171168
172-
173169 title = f"Kyoto Cabinet kccachetest w/wo tilt locks - Host: { hostname } "
174170
175171 # Generate line plot comparing throughput of different lock types
176172 suite .generate_graph (
177- plot_name = "lineplot" ,
178- x = "nb_threads" ,
179- y = "throughput" ,
180- hue = "mutex" ,
181- style = "mutex" ,
182- markers = True ,
183- dashes = False ,
184- title = title ,
173+ plot_name = "lineplot" ,
174+ x = "nb_threads" ,
175+ y = "throughput" ,
176+ hue = "mutex" ,
177+ style = "mutex" ,
178+ markers = True ,
179+ dashes = False ,
180+ title = title ,
185181 )
186182
187183 # Generate scatter plot comparing throughput of different lock types
188184 suite .generate_graph (
189- plot_name = "scatterplot" ,
190- x = "nb_threads" ,
191- y = "throughput" ,
192- hue = "mutex" ,
193- style = "mutex" ,
194- title = title ,
185+ plot_name = "scatterplot" ,
186+ x = "nb_threads" ,
187+ y = "throughput" ,
188+ hue = "mutex" ,
189+ style = "mutex" ,
190+ title = title ,
195191 )
196192
197193
0 commit comments