3333# Performance automation flow: (by intel pnp silicon lab)
3434##################################################################################
3535import subprocess , sys , os , re , argparse , time , statistics , signal , getpass
36-
36+ global temp_path
3737########### James.Iwan@intel.com MSPerf ######################################
3838class 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