Skip to content

Commit

Permalink
Adding the metric dir finally.
Browse files Browse the repository at this point in the history
  • Loading branch information
chzchzchz committed Sep 29, 2010
1 parent 971ab4b commit 4fb324d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
19 changes: 19 additions & 0 deletions metrics/RunStats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python

import os

class RunStats:
def __init__(self, stat_time, fname,test_name):
lines=(open(fname,'r')).readlines()
self.params=dict()
for l in lines:
s=l.split(' ')
param_name=s[0]
param_val=s[1]
self.params[s[0]] = ((s[1]).rstrip())
self.stat_time= stat_time
self.test_name = test_name.rstrip()


def get(self, param_name):
return self.params[param_name]
5 changes: 3 additions & 2 deletions metrics/metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ if [ ! -f tests.log ]; then
fi

#last_commit=`git log --date=short | head -n3 | tail -n1 | cut -f2 -d':'`
d=`date "+%Y-%M-%d-%H:%M.stats"`
d=`date "+%Y-%m-%d-%H:%M.stats"`

v=0
mkdir "${src_root}/metrics/$d/"
while read l; do
FSL_ENV_STATFILE="${src_root}/metrics/$d/$v"
v_name=`printf "%0#10d" $v`
FSL_ENV_STATFILE="${src_root}/metrics/$d/${v_name}"
export FSL_ENV_STATFILE
eval $l
v=`expr $v + 1`
Expand Down
45 changes: 45 additions & 0 deletions metrics/plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/python
import os
import sys

from RunStats import *

file_systems = [ "vfat", "ext2", "nilfs" ]
tests_by_fs = dict()
for fs in file_systems:
tests_by_fs[fs] = []

def process_dir(d):
stat_time=d.split('.')[0]
files=os.listdir(d)
test_names=(open(d+'/tests.log','r')).readlines()
i = 0
files.sort()
for f in files:
if f[0] == 't':
# test.log
continue
for fs in file_systems:
if fs in test_names[i]:
rs = RunStats(stat_time,d+"/"+f,test_names[i])
tests_by_fs[fs].append(rs)
break
i = i+1


def process_fs_tests(fs_name, run_stat_list):
sorted(run_stat_list, key = lambda rs : rs.stat_time)
print fs_name
for rs in run_stat_list:
print rs.test_name
for k in rs.params.keys():
print k +": " + rs.get(k)

args=sys.argv
args.pop(0)
for d in args:
process_dir(d)


for fs in file_systems:
process_fs_tests(fs, tests_by_fs[fs])
1 change: 0 additions & 1 deletion tests/do_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function scan_startup
echo "$cmd" >>tests.log
echo "$cmd" >failed_test_cmd
eval $cmd >cur_test.out
cat cur_test.out
retval=$?
if [ $retval -ne 0 ]; then
echo "Test failed: $fs."
Expand Down

0 comments on commit 4fb324d

Please sign in to comment.