scripts/nvmf_perf: enable SAR by default

Enable SAR CPU measurements by default.
Delay time and sample count variables are now taken
from fio ramp_time and run_time parameters, while
sample interval is hardcoded to 1 second.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Icf2866820250dd6bbc5619b2777f6fe139f2a588
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15339
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
This commit is contained in:
Karol Latecki 2022-11-08 13:53:39 +01:00 committed by Tomasz Zawadzki
parent 2e449d4166
commit 90b95e2813
2 changed files with 15 additions and 17 deletions

View File

@ -27,6 +27,7 @@ To run the scripts in your environment please follow steps below.
to /usr/src/local directory in order to configure NIC ports IRQ affinity. to /usr/src/local directory in order to configure NIC ports IRQ affinity.
If custom directory is to be used, then it must be set using irq_scripts_dir If custom directory is to be used, then it must be set using irq_scripts_dir
option in Target and Initiator configuration sections. option in Target and Initiator configuration sections.
- `sysstat` package must be installed for SAR CPU utilization measurements.
### Optional ### Optional
@ -83,7 +84,7 @@ Optional:
"core_mask": "[1-10]", "core_mask": "[1-10]",
"null_block_devices": 8, "null_block_devices": 8,
"nvmet_bin": "/path/to/nvmetcli", "nvmet_bin": "/path/to/nvmetcli",
"sar_settings": [true, 30, 1, 60], "sar_settings": true,
"pcm_settings": [/tmp/pcm, 30, 1, 60], "pcm_settings": [/tmp/pcm, 30, 1, 60],
"enable_bandwidth": [true, 60], "enable_bandwidth": [true, 60],
"enable_dpdk_memory": [true, 30] "enable_dpdk_memory": [true, 30]
@ -111,10 +112,10 @@ Optional, common:
- null_block_devices - int, number of null block devices to create. - null_block_devices - int, number of null block devices to create.
Detected NVMe devices are not used if option is present. Default: 0. Detected NVMe devices are not used if option is present. Default: 0.
- sar_settings - [bool, int(x), int(y), int(z)]; - sar_settings - bool
Enable SAR CPU utilization measurement on Target side. Enable SAR CPU utilization measurement on Target side. SAR thread will
Wait for "x" seconds before starting measurements, then do "z" samples wait until fio finishes it's "ramp_time" and then start measurement for
with "y" seconds intervals between them. Default: disabled. fio "run_time" duration. Default: enabled.
- pcm_settings - [path, int(x), int(y), int(z)]; - pcm_settings - [path, int(x), int(y), int(z)];
Enable [PCM](https://github.com/opcm/pcm.git) measurements on Target side. Enable [PCM](https://github.com/opcm/pcm.git) measurements on Target side.
Measurements include CPU, memory and power consumption. "path" points to a Measurements include CPU, memory and power consumption. "path" points to a

View File

@ -384,10 +384,7 @@ class Target(Server):
self.pm_delay = 0 self.pm_delay = 0
self.pm_interval = 0 self.pm_interval = 0
self.pm_count = 1 self.pm_count = 1
self.enable_sar = False self.enable_sar = True
self.sar_delay = 0
self.sar_interval = 0
self.sar_count = 0
self.enable_pcm = False self.enable_pcm = False
self.pcm_dir = "" self.pcm_dir = ""
self.pcm_delay = 0 self.pcm_delay = 0
@ -416,8 +413,8 @@ class Target(Server):
self.enable_pm, self.pm_delay, self.pm_interval, self.pm_count = target_config["pm_settings"] self.enable_pm, self.pm_delay, self.pm_interval, self.pm_count = target_config["pm_settings"]
# Normalize pm_count - <= 0 means to loop indefinitely so let's avoid that to not block forever # Normalize pm_count - <= 0 means to loop indefinitely so let's avoid that to not block forever
self.pm_count = self.pm_count if self.pm_count > 0 else 1 self.pm_count = self.pm_count if self.pm_count > 0 else 1
if "sar_settings" in target_config: if "enable_sar" in target_config:
self.enable_sar, self.sar_delay, self.sar_interval, self.sar_count = target_config["sar_settings"] self.enable_sar = target_config["sar_settings"]
if "pcm_settings" in target_config: if "pcm_settings" in target_config:
self.enable_pcm = True self.enable_pcm = True
self.pcm_dir, self.pcm_delay, self.pcm_interval, self.pcm_count = target_config["pcm_settings"] self.pcm_dir, self.pcm_delay, self.pcm_interval, self.pcm_count = target_config["pcm_settings"]
@ -493,17 +490,17 @@ class Target(Server):
ip_bdev_map.append((ip, c)) ip_bdev_map.append((ip, c))
return ip_bdev_map return ip_bdev_map
def measure_sar(self, results_dir, sar_file_prefix): def measure_sar(self, results_dir, sar_file_prefix, ramp_time, run_time):
cpu_number = os.cpu_count() cpu_number = os.cpu_count()
sar_idle_sum = 0 sar_idle_sum = 0
sar_output_file = os.path.join(results_dir, sar_file_prefix + ".txt") sar_output_file = os.path.join(results_dir, sar_file_prefix + ".txt")
sar_cpu_util_file = os.path.join(results_dir, ".".join([sar_file_prefix + "cpu_util", "txt"])) sar_cpu_util_file = os.path.join(results_dir, ".".join([sar_file_prefix + "cpu_util", "txt"]))
self.log.info("Waiting %d seconds for ramp-up to finish before measuring SAR stats" % self.sar_delay) self.log.info("Waiting %d seconds for ramp-up to finish before measuring SAR stats" % ramp_time)
time.sleep(self.sar_delay) time.sleep(ramp_time)
self.log.info("Starting SAR measurements") self.log.info("Starting SAR measurements")
out = self.exec_cmd(["sar", "-P", "ALL", "%s" % self.sar_interval, "%s" % self.sar_count]) out = self.exec_cmd(["sar", "-P", "ALL", "%s" % 1, "%s" % run_time])
with open(os.path.join(results_dir, sar_output_file), "w") as fh: with open(os.path.join(results_dir, sar_output_file), "w") as fh:
for line in out.split("\n"): for line in out.split("\n"):
if "Average" in line: if "Average" in line:
@ -1562,7 +1559,7 @@ if __name__ == "__main__":
threads.append(t) threads.append(t)
if target_obj.enable_sar: if target_obj.enable_sar:
sar_file_prefix = "%s_%s_%s_sar" % (block_size, rw, io_depth) sar_file_prefix = "%s_%s_%s_sar" % (block_size, rw, io_depth)
t = threading.Thread(target=target_obj.measure_sar, args=(args.results, sar_file_prefix)) t = threading.Thread(target=target_obj.measure_sar, args=(args.results, sar_file_prefix, fio_ramp_time, fio_run_time))
threads.append(t) threads.append(t)
if target_obj.enable_pcm: if target_obj.enable_pcm:
@ -1579,7 +1576,7 @@ if __name__ == "__main__":
if target_obj.enable_bandwidth: if target_obj.enable_bandwidth:
bandwidth_file_name = "_".join(["bandwidth", str(block_size), str(rw), str(io_depth)]) bandwidth_file_name = "_".join(["bandwidth", str(block_size), str(rw), str(io_depth)])
bandwidth_file_name = ".".join([bandwidth_file_name, "csv"]) bandwidth_file_name = ".".join([bandwidth_file_name, "csv"])
t = threading.Thread(target=target_obj.measure_network_bandwidth, args=(args.results, bandwidth_file_name,)) t = threading.Thread(target=target_obj.measure_network_bandwidth, args=(args.results, bandwidth_file_name))
threads.append(t) threads.append(t)
if target_obj.enable_dpdk_memory: if target_obj.enable_dpdk_memory: