One python demo to analysis the decoding time and update texture and swapbuffer time
来源:互联网 发布:太极拳威力知乎 编辑:程序博客网 时间:2024/06/11 14:41
avoid to forget to save this python demo here.
#!/usr/bin/python#coding:utf-8#by jamesimport threadingfrom time import ctime,sleepimport osimport stringimport numpy as npimport matplotlib.mlab as mlabimport matplotlib.pyplot as pltthreads = []decode_time_list=[]swap_time_list=[]updateTexture_time_list=[]#analysis log file namefile_name = "2.log"#show the frame count in figureshow_frame_count = -1def process(filename): file = open(filename,"r") decode_line = 0 render_line = 0 update_line = 0 for eachline in file.readlines(): index0 = eachline.find('avcodec_decode_video2') index1 = eachline.find('SDL_RenderPresent') index2 = eachline.find('SDL_UpdateTexture') if index0 != -1: str = eachline.split("[")[1].split("]")[0] time = int(str) decode_time_list.append(time) decode_line += 1 print "decode: %s ms" %str elif index1 != -1: str = eachline.split("[")[1].split("]")[0] time = int(str) swap_time_list.append(time) print "swap : %s ms" %str elif index2 != -1: str = eachline.split("[")[1].split("]")[0] time = int(str) updateTexture_time_list.append(time) print "draw : %s ms" %str print "decoding frame count: %d" %(len(decode_time_list))def drawBar(arr, des): if show_frame_count != -1 : count = show_frame_count else : count = len(arr) print "frame count = %d" %count X = np.arange(count) Y = arr[0:count]#arr fig = plt.figure() bar_width = 1.0 text_hight = 1 plt.bar(X, Y, bar_width, color="red", edgecolor = 'white') #plt.text(X, Y + text_hight, '%d' %Y, ha='center', va= 'bottom') plt.xlabel("frame count") y_str = "time consuming (ms)"; plt.ylabel(y_str) title_str = des + ":" +y_str + ":Frame count:" + str(count); plt.title(title_str) plt.show()t1 = threading.Thread(target=drawBar,args=(decode_time_list,"Decoding",))threads.append(t1)t2 = threading.Thread(target=drawBar,args=(swap_time_list,"SwapBuffer",))threads.append(t2)t3 = threading.Thread(target=drawBar,args=(updateTexture_time_list, "UpdateTexture",))threads.append(t3)if __name__ == '__main__': process(file_name); drawBar(decode_time_list,"Decoding"); drawBar(swap_time_list,"SwapBuffer"); drawBar(updateTexture_time_list,"UpdateTexture"); #for t in threads: # t.setDaemon(False) # t.start() # print "thread ------started"
0 0
- One python demo to analysis the decoding time and update texture and swapbuffer time
- Using MERGE in SQL Server to insert, update and delete at the same time
- Git问题:Cannot update paths and switch to branch 'dev' at the same time.
- fatal: Cannot update paths and switch to branch 'gitlab' at the same time.
- Cannot update paths and switch to branch 'snapshot_mixuse' at the same time.
- Cannot update paths and switch to branch at the same time
- fatal: Cannot update paths and switch to branch 'master' at the same time.
- ubuntu config the time and time zone
- clone 远程分支 Cannot update paths and switch to branch 'dev' at the same time. Did you intend to checko
- git checkout -b时fatal: Cannot update paths and switch to branch '' at the same time.解决方案
- Python and time模块使用
- Formatting Time and Date: The Time and Date Format Suffixes
- 【LeetCode with Python】 Best Time to Buy and Sell Stock
- [LeetCode] [Python] [DP] Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock III Leetcode Python
- 121. Best Time to Buy and Sell Stock [easy] (Python)
- 121. Best Time to Buy and Sell Stock (python)
- 【LeetCode with Python】 Best Time to Buy and Sell Stockd
- 拦截器
- 什么是WEB
- Spring websocket ssl和摘要认证
- HDU1016
- 剑指Offer系列-面试题34:丑数
- One python demo to analysis the decoding time and update texture and swapbuffer time
- 负载均衡的四层和七层区别
- 3、编辑器--动作编辑器需求
- 国际化
- 同一进程下的线程可以共享哪些资源
- 史上最全的Maven Pom文件标签详解
- 哈密顿图
- 动态方法访问
- A算法与A*算法区别