Skip to content

Commit

Permalink
measure-perf: support multiple devices
Browse files Browse the repository at this point in the history
This differentiates temporary artefacts per device and
allows execution on multiple devices in one container.
  • Loading branch information
sunithabhooshanam authored and dvrogozh committed Nov 22, 2022
1 parent 2be1f8b commit 4ac3357
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
7 changes: 4 additions & 3 deletions measure/performance/MSGo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
########### [email protected] Measure Perf ####################################
import subprocess, sys, os, re, argparse, time, statistics, signal

temp_path = "/tmp/perf/"
os_env_DEVICE = os.environ.get('DEVICE' , "/dev/dri/renderD128")
device_name=os_env_DEVICE.split('/')[3]
temp_path = "/tmp/perf_" + device_name + "/"

###################################################################
# This shell script is currently not being Run/Execute on this automation.
Expand All @@ -42,7 +44,6 @@
continue
else:
mediacmd_temp.append(dispatch_cmdline)

d.close()

#Execute Media MultiStreams
Expand All @@ -54,7 +55,7 @@
top_cpu_mem_process = subprocess.Popen(cpu_mem_monitor_cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)

#Monitor GPU_MEM Utilization
gpu_mem_monitor_cmd = "watch -n 0.01 -t -c 'sudo cat /sys/kernel/debug/dri/0/i915_gem_objects >> " + temp_path + clip_session_iter_tag + "_GemObjectSummary.txt 2>&1' &"
gpu_mem_monitor_cmd = "watch -n 0.01 -t -c 'sudo cat /sys/kernel/debug/dri/"+str(int(device_name[-3:])-128)+"/i915_gem_objects >> " + temp_path + clip_session_iter_tag + "_GemObjectSummary.txt 2>&1' &"
gem_gpu_mem_process = subprocess.Popen(gpu_mem_monitor_cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
gem_gpu_mem_process_pid = gem_gpu_mem_process.pid

Expand Down
21 changes: 10 additions & 11 deletions measure/performance/MSPerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Performance automation flow: (by intel pnp silicon lab)
##################################################################################
import subprocess, sys, os, re, argparse, time, statistics, signal, getpass

global temp_path
########### [email protected] MSPerf ######################################
class MediaContent:
width = encode_bitrate = fps_target = performance_stream = performance_fps = init_stream_number = linux_perf_cmdlines = 0
Expand Down Expand Up @@ -134,10 +134,8 @@ def main():


################################# Multiple Device default/user overwrite check #########################
os_env_DEVICE = "/dev/dri/renderD128"
for k, v in os.environ.items():
if k == "DEVICE":
os_env_DEVICE = os.environ['DEVICE']
os_env_DEVICE = os.environ.get('DEVICE' , "/dev/dri/renderD128")
device_name=os_env_DEVICE.split('/')[3]

################################# Variable Assignment #################################################
starting_streamnumber = str(ARGS.startStreams) if ARGS.startStreams else "all:1"
Expand All @@ -157,7 +155,7 @@ def main():
fps_target = float(ARGS.fps_target) if ARGS.fps_target else 0
script_root_path = os.path.dirname(os.path.realpath(__file__))
output_log_filename = str(ARGS.output_log_file) if str(ARGS.output_log_file) != "None" else "msperf.txt"
temp_path = "/tmp/perf/"
temp_path = "/tmp/perf_" + device_name + "/"
##################################################################################
# Initiate artifacts directory
##################################################################################
Expand Down Expand Up @@ -271,7 +269,7 @@ def main():
# jiwan
##################################################################################
content_list_filename = temp_path + "content.list"
cmd_generate_content_list = "ls " + content_path + " | grep -E '\.h264|\.hevc|\.h265|\.mp4' > " + content_list_filename # Add more content container support into the grep list.
cmd_generate_content_list = "ls " + content_path + " | grep -E '\.h264|\.hevc|\.h265|\.mp4|\.ivf|\.av1' > " + content_list_filename # Add more content container support into the grep list.
generate_list_status = os.system(cmd_generate_content_list)

with open(content_list_filename, "r") as content_list_temp_fh:
Expand Down Expand Up @@ -918,7 +916,7 @@ def main():

output_directory_archived = re.sub(r'.txt', "_" + performance_app_tag + "_" + performance_tag + "_traces",output_log_filename)
output_directory_archived = artifact_path + output_directory_archived
move_command = "mv /tmp/perf " + output_directory_archived
move_command = "mv " + temp_path + " " + output_directory_archived
os.system(move_command)

# print out total time during the measure sequence
Expand Down Expand Up @@ -1160,7 +1158,7 @@ def postprocess_multistream(output_log_handle, stream_number, iteration_number,
line_list = re.sub(r'^\s+', "", line) # Remove any leading empty characters.
line_list = re.sub(r'\s+', " ", line_list).split(" ")
top_pid = int(line_list[0])
top_vm_mem = int(line_list[4])
top_vm_mem = int(line_list[4]) if line_list[4].isdigit() else 0
top_res_mem = int(line_list[5])
top_shr_mem = int(line_list[6])
top_cpu_percent = float(line_list[8])
Expand Down Expand Up @@ -1221,10 +1219,11 @@ def postprocess_multistream(output_log_handle, stream_number, iteration_number,
for each_pid in MEM_percent_per_pid_average:
total_MEM_percents_streams = total_MEM_percents_streams + MEM_percent_per_pid_average[each_pid]

if (total_CPU_percents_streams != 0) and (total_MEM_percents_streams != 0):
if (total_CPU_percents_streams != 0):
avg_avg_cpu_percents_streams = round(total_CPU_percents_streams / len(top_pid_list), 2) # take average every each value
if (total_MEM_percents_streams != 0):
avg_avg_mem_percents_streams = round(total_MEM_percents_streams / len(top_pid_list), 2) # take average every each value

print(avg_avg_cpu_percents_streams)
dump_top_list["AVG_CPU_Util:"] = str(avg_avg_cpu_percents_streams)
dump_top_list["AVG_MEM_Util:"] = str(avg_avg_mem_percents_streams)

Expand Down

0 comments on commit 4ac3357

Please sign in to comment.