9
9
from pathlib import Path
10
10
import shutil
11
11
12
+ from redisbench_admin .profilers .profilers_local import (
13
+ check_compatible_system_and_kernel_and_prepare_profile ,
14
+ profilers_start_if_required ,
15
+ local_profilers_platform_checks ,
16
+ profilers_stop_if_required ,
17
+ )
12
18
import docker
13
19
import redis
14
20
from docker .models .containers import Container
36
42
LOG_LEVEL ,
37
43
REDIS_HEALTH_CHECK_INTERVAL ,
38
44
REDIS_SOCKET_TIMEOUT ,
45
+ S3_BUCKET_NAME ,
39
46
)
40
47
from redis_benchmarks_specification .__common__ .package import (
41
48
get_version_string ,
@@ -124,6 +131,20 @@ def main():
124
131
preserve_temporary_client_dirs = args .preserve_temporary_client_dirs
125
132
docker_client = docker .from_env ()
126
133
home = str (Path .home ())
134
+
135
+ profilers_list = []
136
+ profilers_enabled = args .enable_profilers
137
+ if profilers_enabled :
138
+ profilers_list = args .profilers .split ("," )
139
+ res = check_compatible_system_and_kernel_and_prepare_profile (args )
140
+ if res is False :
141
+ logging .error (
142
+ "Requested for the following profilers to be enabled but something went wrong: {}." .format (
143
+ " " .join (profilers_list )
144
+ )
145
+ )
146
+ exit (1 )
147
+
127
148
logging .info ("Running the benchmark specs." )
128
149
129
150
process_self_contained_coordinator_stream (
@@ -136,6 +157,8 @@ def main():
136
157
testsuite_spec_files ,
137
158
{},
138
159
running_platform ,
160
+ profilers_enabled ,
161
+ profilers_list ,
139
162
tls_enabled ,
140
163
tls_skip_verify ,
141
164
tls_cert ,
@@ -198,6 +221,8 @@ def process_self_contained_coordinator_stream(
198
221
testsuite_spec_files ,
199
222
topologies_map ,
200
223
running_platform ,
224
+ profilers_enabled = False ,
225
+ profilers_list = [],
201
226
tls_enabled = False ,
202
227
tls_skip_verify = False ,
203
228
tls_cert = None ,
@@ -258,6 +283,34 @@ def process_self_contained_coordinator_stream(
258
283
ssl_check_hostname = False ,
259
284
)
260
285
r .ping ()
286
+ redis_pids = []
287
+ first_redis_pid = r .info ()["process_id" ]
288
+ redis_pids .append (first_redis_pid )
289
+
290
+ setup_name = "oss-standalone"
291
+ github_actor = "{}-{}" .format (
292
+ tf_triggering_env , running_platform
293
+ )
294
+ dso = "redis-server"
295
+ profilers_artifacts_matrix = []
296
+
297
+ collection_summary_str = ""
298
+ if profilers_enabled :
299
+ collection_summary_str = (
300
+ local_profilers_platform_checks (
301
+ dso ,
302
+ github_actor ,
303
+ git_branch ,
304
+ tf_github_repo ,
305
+ git_hash ,
306
+ )
307
+ )
308
+ logging .info (
309
+ "Using the following collection summary string for profiler description: {}" .format (
310
+ collection_summary_str
311
+ )
312
+ )
313
+
261
314
262
315
ceil_client_cpu_limit = extract_client_cpu_limit (benchmark_config )
263
316
client_cpuset_cpus , current_cpu_pos = generate_cpuset_cpus (
@@ -369,6 +422,23 @@ def process_self_contained_coordinator_stream(
369
422
client_container_image = extract_client_container_image (
370
423
benchmark_config
371
424
)
425
+ profiler_call_graph_mode = "dwarf"
426
+ profiler_frequency = 99
427
+
428
+ # start the profile
429
+ (
430
+ profiler_name ,
431
+ profilers_map ,
432
+ ) = profilers_start_if_required (
433
+ profilers_enabled ,
434
+ profilers_list ,
435
+ redis_pids ,
436
+ setup_name ,
437
+ start_time_str ,
438
+ test_name ,
439
+ profiler_frequency ,
440
+ profiler_call_graph_mode ,
441
+ )
372
442
logging .info (
373
443
"Using docker image {} as benchmark client image (cpuset={}) with the following args: {}" .format (
374
444
client_container_image ,
@@ -402,8 +472,23 @@ def process_self_contained_coordinator_stream(
402
472
benchmark_end_time , benchmark_start_time
403
473
)
404
474
)
475
+ (_ , overall_tabular_data_map ,) = profilers_stop_if_required (
476
+ datasink_push_results_redistimeseries ,
477
+ benchmark_duration_seconds ,
478
+ collection_summary_str ,
479
+ dso ,
480
+ tf_github_org ,
481
+ tf_github_repo ,
482
+ profiler_name ,
483
+ profilers_artifacts_matrix ,
484
+ profilers_enabled ,
485
+ profilers_map ,
486
+ redis_pids ,
487
+ S3_BUCKET_NAME ,
488
+ test_name ,
489
+ )
490
+
405
491
logging .info ("Printing client tool stdout output" )
406
- print ()
407
492
if args .flushall_on_every_test_end :
408
493
logging .info ("Sending FLUSHALL to the DB" )
409
494
r .flushall ()
0 commit comments