template<typename DB> size_t test(int entries, int searches) { { DB db; //time_watch_t ins, srch; //memdbg_start(); //watch_start(&ins); for (int i=1;i < entries;i++) { db.Insert(getk(i), i+1); } //watch_finish(&ins, entries); //watch_start(&srch); //for (int j=0;j < 30;j++) for (int i=1;i < searches;i++) { db.Search(getk(i%entries)); } //watch_finish(&srch, searches); //printf("Insert: "); watch_report(&ins, stdout); //printf(" Search: "); watch_report(&srch, stdout); putchar('\n'); db.Stat(); } //memdbg_end(); return 0; }
int main() { HDC1000 hdc1000_1; MPL115A2 mpl115a2_1; MS5607 ms5607_1; DISPLAY d; LOG l; DB db; hdc1000_1.Init(); mpl115a2_1.Init(); ms5607_1.Init(); std::cout << "Hello\nWorld!\n"; db.Connect(); if( signal(SIGINT, sig_handler) == SIG_ERR) { std::cerr << "sig_handler fail."<<std::endl; } while(1) { std::thread th0(governor); // std::thread th1([&]{hdc1000_1.Get();}); std::thread th2([&]{mpl115a2_1.Get();}); std::thread th3([&]{ms5607_1.Get();}); // l.GetTime();//現在時刻の取得 // th1.join(); th2.join(); th3.join(); // l.Write( hdc1000_1.Read(0),//Temp hdc1000_1.Read(1),//Humi mpl115a2_1.Read(1), mpl115a2_1.Read(0), ms5607_1.Read(1),// ms5607_1.Read(0) //Temp ); // 表示 d.Disp(l); // DBインサート db.Insert(l); // Wait th0.join(); // Terminate if(sig) { std::cout <<"Recieve SIGINT\n"; db.Disconnect(); std::cout <<std::flush; break; } } }