perf/nvmf: Gather power statistics on the target side

Use collect-bmc-pm to gather power usage stats during fio workloads.

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I20d1f3009c8a32c3927ad2cf2f932a8e97d3e7c5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14164
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2022-08-23 21:08:01 +02:00 committed by Tomasz Zawadzki
parent b43a0112dd
commit 04dd028292
2 changed files with 17 additions and 1 deletions

View File

@ -91,7 +91,8 @@ Optional:
"scheduler_settings": "static",
"zcopy_settings": false,
"dif_insert_strip": true,
"null_block_dif_type": 3
"null_block_dif_type": 3,
"enable_pm": true
}
```
@ -131,6 +132,8 @@ Optional, common:
- irq_scripts_dir - path to scripts directory of Mellanox mlnx-tools package;
Used to run set_irq_affinity.sh script.
Default: /usr/src/local/mlnx-tools/ofed_scripts
- enable_pm - if set to true, power measurement is enabled via collect-bmc-pm
on the target side.
Optional, Kernel Target only:

View File

@ -371,6 +371,7 @@ class Target(Server):
self._nics_json_obj = json.loads(self.exec_cmd(["ip", "-j", "address", "show"]))
self.subsystem_info_list = []
self.initiator_info = []
self.enable_pm = True
if "null_block_devices" in target_config:
self.null_block = target_config["null_block_devices"]
@ -389,6 +390,8 @@ class Target(Server):
self.enable_zcopy = target_config["zcopy_settings"]
if "results_dir" in target_config:
self.results_dir = target_config["results_dir"]
if "enable_pm" in target_config:
self.enable_pm = target_config["enable_pm"]
self.script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
self.spdk_dir = os.path.abspath(os.path.join(self.script_dir, "../../../"))
@ -650,6 +653,9 @@ class Target(Server):
with open(os.path.join(results_dir, sar_cpu_util_file), "w") as f:
f.write("%0.2f" % sar_cpu_usage)
def measure_power(self, results_dir, prefix, script_full_dir):
return subprocess.Popen(["%s/../pm/collect-bmc-pm" % script_full_dir, "-d", results_dir, "-l", "-p", prefix, "-x"])
def ethtool_after_fio_ramp(self, fio_ramp_time):
time.sleep(fio_ramp_time//2)
nic_names = [self.get_nic_name_by_ip(n) for n in self.nic_ips]
@ -1555,6 +1561,7 @@ if __name__ == "__main__":
for block_size, io_depth, rw in fio_workloads:
threads = []
configs = []
power_daemon = None
for i in initiators:
if i.mode == "kernel":
i.kernel_init_connect()
@ -1596,6 +1603,9 @@ if __name__ == "__main__":
ethtool_thread = threading.Thread(target=target_obj.ethtool_after_fio_ramp, args=(fio_ramp_time,))
threads.append(ethtool_thread)
if target_obj.enable_pm:
power_daemon = target_obj.measure_power(args.results, "%s_%s_%s" % (block_size, rw, io_depth), script_full_dir)
for t in threads:
t.start()
for t in threads:
@ -1606,6 +1616,9 @@ if __name__ == "__main__":
i.kernel_init_disconnect()
i.copy_result_files(args.results)
if power_daemon:
power_daemon.terminate()
target_obj.restore_governor()
target_obj.restore_tuned()
target_obj.restore_services()