perf/nvmf: Align power measurement with other tools

Run collect-bmc-pm as a thread with execution time limited by count
and interval. This aligns it with the way how other tools - sar,
pcm - are used during the test.

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I48fa4ea1be69f9dcae71bf01c3214102ab329bac
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14628
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Michal Berger 2022-09-22 16:58:25 +02:00 committed by Tomasz Zawadzki
parent ede1049911
commit eb0159cc4e
2 changed files with 20 additions and 11 deletions

View File

@ -92,7 +92,7 @@ Optional:
"zcopy_settings": false,
"dif_insert_strip": true,
"null_block_dif_type": 3,
"enable_pm": true
"pm_settings": [true, 30, 1, 60]
}
```
@ -132,8 +132,9 @@ 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.
- enable_pm - [bool, int(x), int(y), int(z)];
if bool is set to true, power measurement is enabled via collect-bmc-pm on
the target side. For the meaning of remaining options see sar_settings.
Optional, Kernel Target only:

View File

@ -388,7 +388,10 @@ 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
self.enable_pm = False
self.pm_delay = 0
self.pm_interval = 0
self.pm_count = 1
if "null_block_devices" in target_config:
self.null_block = target_config["null_block_devices"]
@ -407,8 +410,10 @@ 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"]
if "pm_settings" in target_config:
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
self.pm_count = self.pm_count if self.pm_count > 0 else 1
self.script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
self.spdk_dir = os.path.abspath(os.path.join(self.script_dir, "../../../"))
@ -502,7 +507,11 @@ class Target(Server):
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"])
time.sleep(self.pm_delay)
self.log_print("Starting power measurements")
self.exec_cmd(["%s/../pm/collect-bmc-pm" % script_full_dir,
"-d", "%s" % results_dir, "-l", "-p", "%s" % prefix,
"-x", "-c", "%s" % self.pm_count, "-t", "%s" % self.pm_interval])
def ethtool_after_fio_ramp(self, fio_ramp_time):
time.sleep(fio_ramp_time//2)
@ -1532,7 +1541,9 @@ if __name__ == "__main__":
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)
power_daemon = threading.Thread(target=target_obj.measure_power,
args=(args.results, "%s_%s_%s" % (block_size, rw, io_depth), script_full_dir))
threads.append(power_daemon)
for t in threads:
t.start()
@ -1543,9 +1554,6 @@ if __name__ == "__main__":
i.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()