]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Modified bench script
authorcazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 26 Sep 2012 23:12:08 +0000 (23:12 +0000)
committercazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 26 Sep 2012 23:12:08 +0000 (23:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@26767 0785d39b-7218-0410-832d-ea1e28bc413d

tests/benchmarks/bench.sh
tests/benchmarks/gettimes/get_times.cc [new file with mode: 0644]

index dd69e00f29ecb809fbf7d78670ccef1eb8d6d989..6da2726cc751a7de1413e3203730c295fb56dc55 100644 (file)
@@ -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 (file)
index 0000000..5ddc93a
--- /dev/null
@@ -0,0 +1,75 @@
+//Jordan Cazamias
+//9-19-2012
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <fstream>
+#include <vector>
+#include <assert.h>
+#include <stdlib.h>
+
+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 << " <Revision Num>" << 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<string> names;
+       vector<float> 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;
+}

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.