scripts/nvmf_perf: add PCM power measurements

Enable pcm-power measurements with appriate option.
This will be used for scheduler tests.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I57acc9905c6f1acd7bc3ecdbf886b209a2cdb653
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5979
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Karol Latecki 2021-01-18 18:59:08 +01:00 committed by Jim Harris
parent 937d4935d0
commit 55e5baf993
2 changed files with 18 additions and 3 deletions

View File

@ -146,11 +146,11 @@ Before using PCM Tools in nvmf perf scripts it needs to be installed on Target m
PCM source and instructions are available on https://github.com/opcm/pcm.
To enable PCM in perf test you need to add Target setting in config.json file:
```
"pcm_settings": ["pcm_directory", "measure_cpu", "measure_memory", delay_time, measure_interval, sample_count]
"pcm_settings": ["pcm_directory", "measure_cpu", "measure_memory", "measure_power", delay_time, measure_interval, sample_count]
```
example:
```
"pcm_settings": ["/tmp/pcm", true, true, 10, 1, 30]
"pcm_settings": ["/tmp/pcm", true, true, true, 10, 1, 30]
```
Example above will run PCM measure for cpu and memory, with start delay 10s, sample every 1 second,
and 30 samples for cpu measure. PCM memory do not support sample count.

View File

@ -47,6 +47,7 @@ class Target(Server):
super(Target, self).__init__(name, username, password, mode, nic_ips, transport)
self.null_block = null_block_devices
self.enable_sar = False
self.enable_pcm_power = False
self.enable_pcm_memory = False
self.enable_pcm = False
self.enable_bandwidth = False
@ -58,7 +59,8 @@ class Target(Server):
self.enable_sar, self.sar_delay, self.sar_interval, self.sar_count = sar_settings
if pcm_settings:
self.pcm_dir, self.enable_pcm, self.enable_pcm_memory, self.pcm_delay, self.pcm_interval, self.pcm_count = pcm_settings
self.pcm_dir, self.enable_pcm, self.enable_pcm_memory, self.enable_pcm_power,\
self.pcm_delay, self.pcm_interval, self.pcm_count = pcm_settings
if bandwidth_settings:
self.enable_bandwidth, self.bandwidth_count = bandwidth_settings
@ -278,6 +280,13 @@ class Target(Server):
skt_pcm_file_name = "_".join(["skt", pcm_file_name])
skt.to_csv(os.path.join(results_dir, skt_pcm_file_name), index=False)
def measure_pcm_power(self, results_dir, pcm_power_file_name):
time.sleep(self.pcm_delay)
out = subprocess.check_output("%s/pcm-power.x %s -i=%s" % (self.pcm_dir, self.pcm_interval, self.pcm_count),
shell=True).decode(encoding="utf-8")
with open(os.path.join(results_dir, pcm_power_file_name), "w") as fh:
fh.write(out)
def measure_bandwidth(self, results_dir, bandwidth_file_name):
bwm = subprocess.run("bwm-ng -o csv -F %s/%s -a 1 -t 1000 -c %s" % (results_dir, bandwidth_file_name,
self.bandwidth_count), shell=True, check=True)
@ -982,6 +991,12 @@ if __name__ == "__main__":
t = threading.Thread(target=target_obj.measure_pcm_memory, args=(target_results_dir, pcm_file_name,))
threads.append(t)
if target_obj.enable_pcm_power:
pcm_file_name = "_".join(["pcm_power", str(block_size), str(rw), str(io_depth)])
pcm_file_name = ".".join([pcm_file_name, "csv"])
t = threading.Thread(target=target_obj.measure_pcm_power, args=(target_results_dir, pcm_file_name,))
threads.append(t)
if target_obj.enable_bandwidth:
bandwidth_file_name = "_".join(["bandwidth", str(block_size), str(rw), str(io_depth)])
bandwidth_file_name = ".".join([bandwidth_file_name, "csv"])