Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions benchmark-scripts/consolidate_multiple_run_of_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def extract_data(self, log_file_path):
idle_cpu_percentage = float(sar_cpu_usage_row_m.group(self._IDLE_CPU_PERCENT_GROUP))
cpu_usages.append(float(100) - idle_cpu_percentage)
if len(cpu_usages) > 0:
return {AVG_CPU_USAGE_CONSTANT: mean(cpu_usages)}
return {AVG_CPU_USAGE_CONSTANT: round(mean(cpu_usages), 2)}
else:
return {AVG_CPU_USAGE_CONSTANT: "NA"}

Expand Down Expand Up @@ -424,7 +424,7 @@ def extract_data(self, log_file_path):
mem_usages.append(mem_usage)

if len(mem_usages) > 0:
return {AVG_MEM_USAGE_CONSTANT: mean(mem_usages) * 100}
return {AVG_MEM_USAGE_CONSTANT: round(mean(mem_usages) * 100, 2)}
else:
return {AVG_MEM_USAGE_CONSTANT: "NA"}

Expand Down Expand Up @@ -454,7 +454,7 @@ def extract_data(self, log_file_path):
power_kpi_dict = {}
for socket_id, power_usages in power_dict.items():
socket_key = "{} {}".format(socket_id, AVG_POWER_USAGE_CONSTANT)
power_kpi_dict[socket_key] = mean(power_usages)
power_kpi_dict[socket_key] = round(mean(power_usages), 2)

if power_kpi_dict:
return power_kpi_dict
Expand Down Expand Up @@ -493,8 +493,8 @@ def extract_data(self, log_file_path):

megabytes_to_bytes = 1000000
if len(disk_read_bytes_per_second) > 0 and len(disk_write_bytes_per_second) > 0:
return {AVG_DISK_READ_BANDWIDTH_CONSTANT: mean(disk_read_bytes_per_second) / megabytes_to_bytes,
AVG_DISK_WRITE_BANDWIDTH_CONSTANT: mean(disk_write_bytes_per_second) / megabytes_to_bytes}
return {AVG_DISK_READ_BANDWIDTH_CONSTANT: round(mean(disk_read_bytes_per_second) / megabytes_to_bytes, 2),
AVG_DISK_WRITE_BANDWIDTH_CONSTANT: round(mean(disk_write_bytes_per_second) / megabytes_to_bytes, 2)}
else:
{AVG_DISK_READ_BANDWIDTH_CONSTANT: "NA", AVG_DISK_WRITE_BANDWIDTH_CONSTANT: "NA"}

Expand All @@ -515,7 +515,7 @@ def extract_data(self, log_file_path):
if 'Memory (MB/s)' in column:
socket_key = "S{} {}".format(socket_count, AVG_MEM_BANDWIDTH_CONSTANT)
mem_bandwidth = df[column].tolist()
socket_memory_bandwidth[socket_key] = mean([ x for x in mem_bandwidth if pd.isna(x) == False ])
socket_memory_bandwidth[socket_key] = round(mean([ x for x in mem_bandwidth if pd.isna(x) == False ]), 2)
socket_count = socket_count + 1

if socket_memory_bandwidth:
Expand All @@ -542,7 +542,7 @@ def extract_data(self, log_file_path):
average_fps_list.append(float(line))

if len(average_fps_list) > 0:
camera_fps[camera_key] = mean(average_fps_list)
camera_fps[camera_key] = round(mean(average_fps_list), 2)
else:
camera_fps[camera_key] = "NA"

Expand All @@ -567,7 +567,7 @@ def extract_data(self, log_file_path):
average_fps_list.append(float((line.split(":"))[1].replace(",", "")))

if len(average_fps_list) > 0:
camera_fps[camera_key] = mean(average_fps_list)
camera_fps[camera_key] = round(mean(average_fps_list), 2)

if camera_fps:
return camera_fps
Expand Down Expand Up @@ -701,7 +701,7 @@ def extract_data(self, log_file_path):
pass
if numeric_values: # Make sure we have values to calculate mean
socket_key = "S{} {}".format(socket_count, AVG_MEM_BANDWIDTH_CONSTANT)
socket_memory_and_power[socket_key] = 1000 * mean(numeric_values)
socket_memory_and_power[socket_key] = round(1000 * mean(numeric_values), 2)
socket_count = socket_count + 1

print("parsing power usage")
Expand All @@ -722,7 +722,7 @@ def extract_data(self, log_file_path):
pass
if numeric_values: # Make sure we have values to calculate mean
socket_key = "S{} {}".format(socket_count, AVG_POWER_USAGE_CONSTANT)
socket_memory_and_power[socket_key] = mean(numeric_values)
socket_memory_and_power[socket_key] = round(mean(numeric_values), 2)
socket_count = socket_count + 1

if socket_memory_and_power:
Expand Down