オリジナル-性能テスト編-3 D性能テストスクリプト


shellスクリプト、test_95.sh
#!/bin/sh

# 3D      
#   3D      ,    3D   ,
#     ,  ,       

test_title="3D         95"
expect_result="    :  3D    、    、  、  ,     FPS"
result_path=./

echo -e "
" >> ${result_path}test_95_result.txt date >> ${result_path}test_95_result.txt echo ${test_title} >> ${result_path}test_95_result.txt echo -e >> ${result_path}test_95_result.txt echo ${expect_result} >> ${result_path}test_95_result.txt # 2 python vblank_mode=0 glxgears > ${result_path}test_95_result2.txt

 
test_95.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-

#         sh      ,     shell    
import commands,os,subprocess
#  3D      FPS,    
#   
f1 = open("test_95_result2.txt","r")
line_f1 = f1.readlines()  #readlines()       
line_f1_1 = line_f1[0]
line_f1_2 = line_f1[1]
line_f1_3 = line_f1[2]
line_f1_4 = line_f1[3]
line_f1_5 = line_f1[4]
line_f1_6 = line_f1[5]
line_f1_7 = line_f1[6]
line_f1_8 = line_f1[7]
line_f1_9 = line_f1[8]
line_f1_10 = line_f1[9]

#   
line_f1_1_7 = line_f1_1.split()[6]
#print line_f1_1_7
line_f1_2_7 = line_f1_2.split()[6]
line_f1_3_7 = line_f1_3.split()[6]
line_f1_4_7 = line_f1_4.split()[6]
line_f1_5_7 = line_f1_5.split()[6]
line_f1_6_7 = line_f1_6.split()[6]
line_f1_7_7 = line_f1_7.split()[6]
line_f1_8_7 = line_f1_8.split()[6]
line_f1_9_7 = line_f1_9.split()[6]
line_f1_10_7 = line_f1_10.split()[6]

average = (float(line_f1_1_7) + float(line_f1_2_7) + float(line_f1_3_7) + float(line_f1_4_7) + float(line_f1_5_7) + float(line_f1_6_7) + float(line_f1_7_7) + float(line_f1_8_7) + float(line_f1_9_7) + float(line_f1_10_7)) / 10
f1.close()
print "average:"+ str(average) + "FPS"
fw1 = file("test_95_result.txt","a+")
fw1.write("\r
average" + str(average) + " FPS\r
") fw1.close() # glxgears # glxgears id subprocess.call("ps -aux | grep glxgears > glxgears.txt",shell=True) f2 = open("glxgears.txt","r") line_f2 = f2.readlines()[0] line_2_f2 = line_f2.split()[1] print line_2_f2 f2.close() subprocess.call("sleep 3",shell=True) subprocess.call("kill -9 "+line_2_f2,shell=True) subprocess.call("rm -rf glxgears.txt",shell=True)