]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/tools/advisor/advisor/bench_runner.py
1 # Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 # This source code is licensed under both the GPLv2 (found in the
3 # COPYING file in the root directory) and Apache 2.0 License
4 # (found in the LICENSE.Apache file in the root directory).
6 from abc
import ABC
, abstractmethod
10 class BenchmarkRunner(ABC
):
13 def is_metric_better(new_metric
, old_metric
):
17 def run_experiment(self
):
18 # should return a list of DataSource objects
22 def get_info_log_file_name(log_dir
, db_path
):
23 # Example: DB Path = /dev/shm and OPTIONS file has option
24 # db_log_dir=/tmp/rocks/, then the name of the log file will be
25 # 'dev_shm_LOG' and its location will be /tmp/rocks. If db_log_dir is
26 # not specified in the OPTIONS file, then the location of the log file
27 # will be /dev/shm and the name of the file will be 'LOG'
30 # refer GetInfoLogPrefix() in rocksdb/util/filename.cc
31 # example db_path: /dev/shm/dbbench
32 file_name
= db_path
[1:] # to ignore the leading '/' character
33 to_be_replaced
= re
.compile('[^0-9a-zA-Z\-_\.]')
34 for character
in to_be_replaced
.findall(db_path
):
35 file_name
= file_name
.replace(character
, '_')
36 if not file_name
.endswith('_'):