From 056072ec2c9c35584f3a40ba5cdc76a285bde647 Mon Sep 17 00:00:00 2001 From: cazamias Date: Wed, 3 Oct 2012 21:50:57 +0000 Subject: [PATCH] Updated bench.sh to extract names git-svn-id: https://svn.dealii.org/trunk@26937 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/benchmarks/bench.sh | 8 ++-- tests/benchmarks/gettimes/get_times.cc | 56 +++++++++++++++++++++----- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/tests/benchmarks/bench.sh b/tests/benchmarks/bench.sh index 4beb60f9e7..10b55bb638 100644 --- a/tests/benchmarks/bench.sh +++ b/tests/benchmarks/bench.sh @@ -4,7 +4,7 @@ TESTS="step-22 tablehandler" PREVREVISION="`svn info deal.II | grep Revision | sed s/Revision://`" HEADREVISION="`svn info http://www.dealii.org/svn/dealii | grep Revision | sed s/Revision://`" -MAKECMD="make -j6" +MAKECMD="make -j2" export MAKECMD echo "previous $PREVREVISION" @@ -35,7 +35,10 @@ while [ $PREVREVISION -lt $HEADREVISION ] ; do echo "** working on $test" make clean >/dev/null make run | grep "|" > temp.txt - #cat temp.txt >>../datatable.$test + ./../gettimes/gettimes > names.test + if [[ -s names.test ]] ; then + cp names.test ../names.$test + fi ; ./../gettimes/gettimes $NEXTREVISION >>../datatable.$test cd .. @@ -44,4 +47,3 @@ while [ $PREVREVISION -lt $HEADREVISION ] ; do done echo "DONE WITH REGRESSION TESTS ON `date`" - diff --git a/tests/benchmarks/gettimes/get_times.cc b/tests/benchmarks/gettimes/get_times.cc index 5a8b127d9b..87004bf14c 100644 --- a/tests/benchmarks/gettimes/get_times.cc +++ b/tests/benchmarks/gettimes/get_times.cc @@ -18,12 +18,6 @@ int main(int argc, char *argv[]) { const int IGNORE_LINES = 3; //Number of initial lines to ignore input.open("temp.txt"); - if(argc <= 1) - { - cerr << "Error: " << argv[0] << " requires one argument" << endl; - cerr << " " << endl; - return 1; - } ////cout << "Revision " << argv[1] << endl; @@ -36,8 +30,39 @@ int main(int argc, char *argv[]) { vector names; vector times; + + if(argc <= 1) { + while(!input.eof()) { + //If no revision number, retrieve column names + string curr_line; + getline(input, curr_line); + if(curr_line == "") + continue; + + ////cout << "curr line: " << curr_line << endl; + //Looking for the string after the '|' and ' ' + int first_char = 0; + if(curr_line[0] == '|') + first_char++; + if (curr_line[1] == ' ') + first_char++; + + ////cout << "first char at pos: " << first_char << endl; + + //Test case: char at position first_char is a letter + assert(isalpha(curr_line[first_char])); + + //Find position of first space that occurs after the word + int num_chars = 0; + while(!isspace(curr_line[first_char + num_chars])) + num_chars++; + + names.push_back(curr_line.substr(first_char, num_chars)); + } + } + - //Extract name and execution time from each line + //Extract and execution time from each line while(!input.eof()) { string curr_line; @@ -63,10 +88,21 @@ int main(int argc, char *argv[]) { } + //Output individual names + if(argc <= 1) { + for(int i = 0; i < names.size(); i++) { + cout << names[i]; + if(i < names.size() - 1) + cout << endl; + } + } + //Output individual times - cout << argv[1]; - for(int i = 0; i < times.size(); i++) - cout << " " << times[i]; + if(argc > 1) { + cout << argv[1]; + for(int i = 0; i < times.size(); i++) + cout << " " << times[i]; + } cout << endl; -- 2.39.5