Show timeout in http stats

This commit is contained in:
Aang23 2022-08-23 00:22:48 +02:00
parent dae517aad7
commit 4c26dfd970
3 changed files with 7 additions and 7 deletions

View file

@ -30,7 +30,8 @@ namespace webserver
// HTTP Handler for stats
void http_handle(nng_aio *aio)
{
std::string jsonstr = live_pipeline->getModulesStats().dump(4);
live_pipeline->updateModuleStats();
std::string jsonstr = live_pipeline->stats.dump(4);
nng_http_res *res;
nng_http_res_alloc(&res);
@ -256,6 +257,8 @@ int main_live(int argc, char *argv[])
logger->warn("Timeout is over! ({:d}s >= {:d}s) Stopping.", elapsed_time, timeout);
break;
}
live_pipeline->stats["timeout_left"] = timeout - elapsed_time;
}
if (live_should_exit)

View file

@ -181,15 +181,11 @@ namespace satdump
return modules[num]->getOutputs();
}
nlohmann::json LivePipeline::getModulesStats()
void LivePipeline::updateModuleStats()
{
nlohmann::json stats;
for (std::shared_ptr<ProcessingModule> mod : modules)
{
if (mod->module_stats.size() > 0)
stats[mod->getIDM()] = mod->module_stats;
}
return stats;
}
void LivePipeline::drawUIs()

View file

@ -32,7 +32,8 @@ namespace satdump
std::vector<std::string> getOutputFiles();
nlohmann::json getModulesStats();
nlohmann::json stats;
void updateModuleStats();
void drawUIs();
};