Infering the number of runs
[satune.git] / src / Test / analyzemultituner.cc
index 85a510afb553558d3ffbbc0507df9aa88b355356..f132e74e15079eaf5b2131b87a4b701cdf594445 100644 (file)
@@ -1,17 +1,33 @@
 #include "csolver.h"
-#include "multituner.h"
+#include "comptuner.h"
 #include "searchtuner.h"
+#include "dirent.h"
 
-int main(int argc, char **argv) {
-       if (argc < 2) {
-               printf("You should specify number of runs\n");
-               exit(-1);
+uint getNumberOfRuns(){
+       uint runs = 0;
+       DIR *dir;
+       struct dirent *ent;
+       if ((dir = opendir ("./")) != NULL) {
+               /* print all the files and directories within directory */
+               while ((ent = readdir (dir)) != NULL) {
+                       if(strstr(ent->d_name, "result") != NULL){
+                               runs++;
+                       }
+               }
+               closedir (dir);
+       } else {
+               perror ("Unable to open the directory\n");
+               exit(1);
        }
-       uint numruns;
-       sscanf(argv[1], "%u", &numruns);
+       return runs;
+}
 
-       MultiTuner *multituner = new MultiTuner(0, 0, 0);
+int main(int argc, char **argv) {
+       uint numruns = getNumberOfRuns();
+       printf("Number of Runs: %u\n", numruns);
+       CompTuner *multituner = new CompTuner(0, 0);
        multituner->readData(numruns);
+       multituner->findBestThreeTuners();
        delete multituner;
        return 0;
 }