From 4fb324dd7977421c74c2104a444b190bcae01218 Mon Sep 17 00:00:00 2001 From: chz Date: Wed, 29 Sep 2010 03:51:45 -0700 Subject: [PATCH] Adding the metric dir finally. --- metrics/RunStats.py | 19 ++++++++++++++++++ metrics/metrics.sh | 5 +++-- metrics/plot.py | 45 +++++++++++++++++++++++++++++++++++++++++++ tests/do_all_tests.sh | 1 - 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 metrics/RunStats.py create mode 100755 metrics/plot.py diff --git a/metrics/RunStats.py b/metrics/RunStats.py new file mode 100644 index 0000000..36dd679 --- /dev/null +++ b/metrics/RunStats.py @@ -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] diff --git a/metrics/metrics.sh b/metrics/metrics.sh index d5ad96c..113ac27 100755 --- a/metrics/metrics.sh +++ b/metrics/metrics.sh @@ -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` diff --git a/metrics/plot.py b/metrics/plot.py new file mode 100755 index 0000000..41f637e --- /dev/null +++ b/metrics/plot.py @@ -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]) diff --git a/tests/do_all_tests.sh b/tests/do_all_tests.sh index df2684a..262b37f 100755 --- a/tests/do_all_tests.sh +++ b/tests/do_all_tests.sh @@ -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."