From: cazamias Date: Wed, 26 Sep 2012 23:12:08 +0000 (+0000) Subject: Modified bench script X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed031ff9f32b3cdcb37a4aa4656b1f50cfea407a;p=dealii-svn.git Modified bench script git-svn-id: https://svn.dealii.org/trunk@26767 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/benchmarks/bench.sh b/tests/benchmarks/bench.sh index dd69e00f29..6da2726cc7 100644 --- a/tests/benchmarks/bench.sh +++ b/tests/benchmarks/bench.sh @@ -33,9 +33,8 @@ while [ $PREVREVISION -lt $HEADREVISION ] ; do echo "** working on $test" make clean >/dev/null make run | grep "|" > temp.txt - cat temp.txt >>../datatable.$test - #./your_code $NEXTREVISION >>../datatable.$test - # collect info + #cat temp.txt >>../datatable.$test + ./../gettimes/a.out $NEXTREVISION >>../datatable.$test cd .. done diff --git a/tests/benchmarks/gettimes/get_times.cc b/tests/benchmarks/gettimes/get_times.cc new file mode 100644 index 0000000000..5ddc93ad88 --- /dev/null +++ b/tests/benchmarks/gettimes/get_times.cc @@ -0,0 +1,75 @@ +//Jordan Cazamias +//9-19-2012 + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +int main(int argc, char *argv[]) { + + ifstream input; + stringstream ss; + const int IGNORE_LINES = 3; //Number of initial lines to ignore + + input.open("test_input.txt"); + if(argc <= 1) + { + cerr << "Error: " << argv[0] << " requires one argument" << endl; + cerr << " " << endl; + return 1; + } + + ////cout << "Revision " << argv[1] << endl; + + //Ignore first n lines- they don't hold any useful data + for(int i = 0; i < IGNORE_LINES; i++) + { + string dummy; + getline(input, dummy); + } + + vector names; + vector times; + + //Extract name and execution time from each line + while(!input.eof()) + { + string curr_line; + getline(input, curr_line); + ////cout << curr_line << endl; + if(curr_line == "") + continue; + + //Looking for a number that ends with 's' + int last_s = curr_line.rfind('s'); + //In case 's' is not used in the future + assert(isdigit(curr_line[last_s - 1])); // Test: s preceded by number + + //Find time string and convert to double + int num_start = last_s - 1; + while(isdigit(curr_line[num_start]) || curr_line[num_start] == '.') + num_start--; + string timestr = curr_line.substr(num_start+1, last_s - num_start); + ////cout << timestr << endl; + double time = (double)atof(timestr.substr(0,timestr.size()-1).c_str()); + ////cout << time << endl; + times.push_back(time); + } + + + //Output individual times + cout << argv[1]; + for(int i = 0; i < times.size(); i++) + cout << " " << times[i]; + + cout << endl; + + + return 0; +}