Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 4ac3357

Browse files
sunithabhooshanamdvrogozh
authored andcommitted
measure-perf: support multiple devices
This differentiates temporary artefacts per device and allows execution on multiple devices in one container.
1 parent 2be1f8b commit 4ac3357

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

measure/performance/MSGo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
########### Scott.Rowe@intel.com Measure Perf ####################################
2525
import subprocess, sys, os, re, argparse, time, statistics, signal
2626

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

2931
###################################################################
3032
# This shell script is currently not being Run/Execute on this automation.
@@ -42,7 +44,6 @@
4244
continue
4345
else:
4446
mediacmd_temp.append(dispatch_cmdline)
45-
4647
d.close()
4748

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

5657
#Monitor GPU_MEM Utilization
57-
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' &"
58+
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' &"
5859
gem_gpu_mem_process = subprocess.Popen(gpu_mem_monitor_cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
5960
gem_gpu_mem_process_pid = gem_gpu_mem_process.pid
6061

measure/performance/MSPerf.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# Performance automation flow: (by intel pnp silicon lab)
3434
##################################################################################
3535
import subprocess, sys, os, re, argparse, time, statistics, signal, getpass
36-
36+
global temp_path
3737
########### James.Iwan@intel.com MSPerf ######################################
3838
class MediaContent:
3939
width = encode_bitrate = fps_target = performance_stream = performance_fps = init_stream_number = linux_perf_cmdlines = 0
@@ -134,10 +134,8 @@ def main():
134134

135135

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

142140
################################# Variable Assignment #################################################
143141
starting_streamnumber = str(ARGS.startStreams) if ARGS.startStreams else "all:1"
@@ -157,7 +155,7 @@ def main():
157155
fps_target = float(ARGS.fps_target) if ARGS.fps_target else 0
158156
script_root_path = os.path.dirname(os.path.realpath(__file__))
159157
output_log_filename = str(ARGS.output_log_file) if str(ARGS.output_log_file) != "None" else "msperf.txt"
160-
temp_path = "/tmp/perf/"
158+
temp_path = "/tmp/perf_" + device_name + "/"
161159
##################################################################################
162160
# Initiate artifacts directory
163161
##################################################################################
@@ -271,7 +269,7 @@ def main():
271269
# jiwan
272270
##################################################################################
273271
content_list_filename = temp_path + "content.list"
274-
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.
272+
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.
275273
generate_list_status = os.system(cmd_generate_content_list)
276274

277275
with open(content_list_filename, "r") as content_list_temp_fh:
@@ -918,7 +916,7 @@ def main():
918916

919917
output_directory_archived = re.sub(r'.txt', "_" + performance_app_tag + "_" + performance_tag + "_traces",output_log_filename)
920918
output_directory_archived = artifact_path + output_directory_archived
921-
move_command = "mv /tmp/perf " + output_directory_archived
919+
move_command = "mv " + temp_path + " " + output_directory_archived
922920
os.system(move_command)
923921

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

1224-
if (total_CPU_percents_streams != 0) and (total_MEM_percents_streams != 0):
1222+
if (total_CPU_percents_streams != 0):
12251223
avg_avg_cpu_percents_streams = round(total_CPU_percents_streams / len(top_pid_list), 2) # take average every each value
1224+
if (total_MEM_percents_streams != 0):
12261225
avg_avg_mem_percents_streams = round(total_MEM_percents_streams / len(top_pid_list), 2) # take average every each value
1227-
1226+
print(avg_avg_cpu_percents_streams)
12281227
dump_top_list["AVG_CPU_Util:"] = str(avg_avg_cpu_percents_streams)
12291228
dump_top_list["AVG_MEM_Util:"] = str(avg_avg_mem_percents_streams)
12301229

0 commit comments

Comments
 (0)