replaceVarWithConst(pred, left, right);
} else if (pred->isFalse() && updateSets) {
constrainVarWithConst(pred, left, right);
- } else ASSERT(0);
+ }
}
void ElementOpt::handlePredicateInequality(BooleanPredicate *pred, ElementSet *var, ElementConst *value) {
#include "searchtuner.h"
+#include <iostream>
+#include <fstream>
+using namespace std;
TunableSetting::TunableSetting(VarType _type, TunableParam _param) :
hasVar(true),
setting1->param == setting2->param;
}
+ostream& operator<<(ostream& os, const TunableSetting& ts)
+{
+ os << ts.hasVar <<" " << ts.type1 <<" " << ts.type2 << " " << ts.param << " " << ts.lowValue <<" "
+ << ts.highValue << " " << ts.defaultValue << " " << ts.selectedValue;
+ return os;
+}
+
+
SearchTuner::SearchTuner() {
+ ifstream myfile;
+ myfile.open (TUNEFILE, ios::in);
+ if(myfile.is_open()){
+ bool hasVar;
+ VarType type1;
+ VarType type2;
+ TunableParam param;
+ int lowValue;
+ int highValue;
+ int defaultValue;
+ int selectedValue;
+ while(myfile >> hasVar >> type1 >> type2 >> param >> lowValue >> highValue >> defaultValue >> selectedValue){
+ TunableSetting *setting;
+
+ if(hasVar){
+ setting = new TunableSetting(type1, type2, param);
+ }else{
+ setting = new TunableSetting(param);
+ }
+ setting->setDecision(lowValue, highValue, defaultValue, selectedValue);
+ usedSettings.add(setting);
+ }
+ myfile.close();
+ }
}
SearchTuner *SearchTuner::copyUsed() {
}
+void SearchTuner::serialize() {
+ ofstream myfile;
+ myfile.open (TUNEFILE, ios::out | ios::trunc);
+ SetIteratorTunableSetting *iterator = settings.iterator();
+ while (iterator->hasNext()) {
+ TunableSetting *setting = iterator->next();
+ myfile << *setting << endl;
+ }
+ myfile.close();
+ delete iterator;
+}
+
void SearchTuner::printUsed() {
SetIteratorTunableSetting *iterator = usedSettings.iterator();
while (iterator->hasNext()) {
#include "classlist.h"
#include "tunable.h"
#include "structs.h"
+#include <ostream>
+using namespace std;
+#define TUNEFILE "tune.conf"
class TunableSetting {
public:
TunableSetting(TunableSetting *ts);
void setDecision(int _low, int _high, int _default, int _selection);
void print();
+ friend std::ostream& operator<< (std::ostream& stream, const TunableSetting& matrix);
CMEMALLOC;
private:
bool hasVar;
uint getSize() { return usedSettings.getSize();}
void print();
void printUsed();
-
+ void serialize();
+
CMEMALLOC;
private:
/** Used Settings keeps track of settings that were actually used by
/** Settings contains all settings. */
HashsetTunableSetting settings;
};
+
+
#endif