]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Updated bench.sh to extract names
authorcazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 3 Oct 2012 21:50:57 +0000 (21:50 +0000)
committercazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 3 Oct 2012 21:50:57 +0000 (21:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@26937 0785d39b-7218-0410-832d-ea1e28bc413d

tests/benchmarks/bench.sh
tests/benchmarks/gettimes/get_times.cc

index 4beb60f9e705049c657335bdf4caa6a48e6adc27..10b55bb638235179d13d372f47e56c00607598c5 100644 (file)
@@ -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`"
-
index 5a8b127d9b93c9c5b8f511016ee2eabcc8a2e20b..87004bf14c8a5f31ff719009a4710077df98f5c1 100644 (file)
@@ -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 << " <Revision Num>" << endl;
-               return 1;
-       }
 
        ////cout << "Revision " << argv[1] << endl;
        
@@ -36,8 +30,39 @@ int main(int argc, char *argv[]) {
 
        vector<string> names;
        vector<double> 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;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.