#include #include "rinex.hh" #include "navmon.hh" #include #include "fmt/format.h" #include "fmt/printf.h" #include #include #include #include #include #include "ephemeris.hh" #include using namespace std; struct svstat { int health{0}; int napa{0}; int stale{0}; }; template struct HanderOuter { HanderOuter(const std::deque& things) : d_things(things) {} bool getOne(T& str) { std::lock_guard mut(d_mut); if(d_things.empty()) return false; str = d_things.front(); d_things.pop_front(); return true; } std::deque d_things; std::mutex d_mut; }; typedef map> stat_t; auto worker(HanderOuter* ho) { std::string file; auto stat = std::make_unique(); while(ho->getOne(file)) { try { RINEXReader rr(file); RINEXEntry e; while(rr.get(e)) { if(e.gnss != 2 || e.sv == 14 || e.sv == 18) continue; SatID sid{(uint32_t)e.gnss, (uint32_t)e.sv, 0}; auto& h=(*stat)[sid][e.t/3600]; if(e.sisa < 0) { h.napa++; } if(e.health) { h.health++; } if(fabs(ephAge(e.tow, e.toe)) > 4*3600) { // cout << humanTime(e.t)<<": "< files; while(getline(filefile, fname)) files.push_back(fname); HanderOuter ho(files); vector>> futs; for(int n=0; n < 5; ++n) futs.push_back(std::async(worker, &ho)); stat_t stat; for(auto& f : futs) { auto s = f.get(); for(const auto& e : *s) { for(const auto& h : e.second) { auto& u = stat[e.first][h.first]; u.napa += h.second.napa; u.health += h.second.health; u.stale += h.second.stale; } } } int totnapa{0}, tothours{0}, totstale{0}, totissue{0}; int tothealth{0}; ofstream dump("dump"); set hours; for(const auto& sv : stat) { cout<first; time_t stop = 3600*sv.second.rbegin()->first; cout< phours = hours; for(const auto& h : sv.second) { phours.erase(h.first); } for(const auto& missing : phours) { misnum++; cout<<" "<