Using Python to show the test data
2017-03-15 16:54
363 查看
#!/usr/bin/python
#coding:utf-8
import os
import string
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
decode_time_list=[]
swap_time_list=[]
updateTexture_time_list=[]
def drawBar(arr, des):
X=range(len(arr))
Y=arr
fig = plt.figure()
plt.bar(X,Y,0.5,color="green",align='center')
plt.xlabel(des + " frame count")
y_str = des + " time consuming (ms)";
plt.ylabel(y_str)
plt.title(y_str)
plt.show()
def process(filename):
file = open(filename,"r")
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)
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))
if __name__ == "__main__":
fn = "1.log.test"
process(fn)
drawBar(decode_time_list, "decoding");
drawBar(swap_time_list, "swap buffer");
drawBar(updateTexture_time_list, "update texture");
Python to show the test output data
#coding:utf-8
import os
import string
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
decode_time_list=[]
swap_time_list=[]
updateTexture_time_list=[]
def drawBar(arr, des):
X=range(len(arr))
Y=arr
fig = plt.figure()
plt.bar(X,Y,0.5,color="green",align='center')
plt.xlabel(des + " frame count")
y_str = des + " time consuming (ms)";
plt.ylabel(y_str)
plt.title(y_str)
plt.show()
def process(filename):
file = open(filename,"r")
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)
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))
if __name__ == "__main__":
fn = "1.log.test"
process(fn)
drawBar(decode_time_list, "decoding");
drawBar(swap_time_list, "swap buffer");
drawBar(updateTexture_time_list, "update texture");
Python to show the test output data
相关文章推荐
- using JS to control two select(html),the data can be loaded from database and XML,and show in the select
- Python Web-第六周-JSON and the REST Architecture(Using Python to Access Web Data)
- Python Web-第四周-Programs that Surf the Web(Using Python to Access Web Data)
- Sql Script To set the show sort of data ( up or down )
- Add data to the Access database using ADO
- [Project] Simulate HTTP Post Request to obtain data from Web Page by using Python Scrapy Framework
- Coursera Using python to access Web data
- 102.You want to import schema objects of the HR user using Oracle Data Pump from the development dat
- The easy way to execute sudo command in Python using subprocess.Popen
- 75.Your test database is configured to run in NOARCHIVELOG mode. One of the data files in the USERS
- Using Bootstrap popover to show the MVC unobtrusive error
- Openstack: python API “how to download image from glance using the python api”
- Using the HTMLControl Class in Adobe AIR to parse HTML as a data source
- Coursera Using python to access Web data quiz 3
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- Unable to determine the principal end of an association between the types '***. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
- python网络编程经典好文,如何用urllib获取internet资源,HOWTO Fetch Internet Resources Using The urllib Package
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- Python Web-第二周-正则表达式(Using Python to Access Web Data)
- Python Web-第三周-Networks and Sockets(Using Python to Access Web Data)