Added STATS_DELAY compile flag for overriding the statistics delay for better or worse accuracy than the default.
This commit is contained in:
parent
36d8986f4b
commit
9e8b07cbfc
3 changed files with 23 additions and 3 deletions
|
@ -103,6 +103,13 @@ if (DEFINED NOCRASHCHECK )
|
||||||
add_definitions(-DNOCRASHCHECK=1)
|
add_definitions(-DNOCRASHCHECK=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Build Variables - Stats delay overrid#
|
||||||
|
########################################
|
||||||
|
if (DEFINED STATS_DELAY )
|
||||||
|
add_definitions(-DSTATS_DELAY=${STATS_DELAY})
|
||||||
|
endif()
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# Build Variables - Prepare for Build #
|
# Build Variables - Prepare for Build #
|
||||||
########################################
|
########################################
|
||||||
|
|
|
@ -264,6 +264,14 @@ bool Util::Config::parseArgs(int & argc, char ** & argv) {
|
||||||
#ifdef KILLONEXIT
|
#ifdef KILLONEXIT
|
||||||
std::cout << "- Flag: Kill on exit. All binaries will forcibly shut down all their children on exit. This disabled rolling restart support." << std::endl;
|
std::cout << "- Flag: Kill on exit. All binaries will forcibly shut down all their children on exit. This disabled rolling restart support." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef STATS_DELAY
|
||||||
|
std::cout << "- Setting: Stats delay " << STATS_DELAY << ". Statistics of viewer counts are delayed by " << STATS_DELAY << " seconds as opposed to the default of 15 seconds. ";
|
||||||
|
if (STATS_DELAY > 15){
|
||||||
|
std::cout << "This makes them more accurate." << std::endl;
|
||||||
|
}else{
|
||||||
|
std::cout << "This makes them less accurate." << std::endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/*LTS-END*/
|
/*LTS-END*/
|
||||||
std::cout << "Built on " __DATE__ ", " __TIME__ << std::endl;
|
std::cout << "Built on " __DATE__ ", " __TIME__ << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
|
|
||||||
#define COUNTABLE_BYTES 128*1024
|
#define COUNTABLE_BYTES 128*1024
|
||||||
|
|
||||||
|
#ifndef STATS_DELAY
|
||||||
|
#define STATS_DELAY 15
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
std::map<Controller::sessIndex, Controller::statSession> Controller::sessions; ///< list of sessions that have statistics data available
|
std::map<Controller::sessIndex, Controller::statSession> Controller::sessions; ///< list of sessions that have statistics data available
|
||||||
std::map<unsigned long, Controller::sessIndex> Controller::connToSession; ///< Map of socket IDs to session info.
|
std::map<unsigned long, Controller::sessIndex> Controller::connToSession; ///< Map of socket IDs to session info.
|
||||||
bool Controller::killOnExit = KILL_ON_EXIT;
|
bool Controller::killOnExit = KILL_ON_EXIT;
|
||||||
|
@ -750,7 +755,7 @@ void Controller::fillActive(JSON::Value & req, JSON::Value & rep, bool onlyNow){
|
||||||
//collect the data first
|
//collect the data first
|
||||||
std::set<std::string> streams;
|
std::set<std::string> streams;
|
||||||
std::map<std::string, unsigned long> clients;
|
std::map<std::string, unsigned long> clients;
|
||||||
unsigned int t = Util::epoch() - 15;
|
unsigned int t = Util::epoch() - STATS_DELAY;
|
||||||
//check all sessions
|
//check all sessions
|
||||||
if (sessions.size()){
|
if (sessions.size()){
|
||||||
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
||||||
|
@ -1059,7 +1064,7 @@ void Controller::handlePrometheus(HTTP::Parser & H, Socket::Connection & conn, i
|
||||||
//collect the data first
|
//collect the data first
|
||||||
std::map<std::string, unsigned long> clients;
|
std::map<std::string, unsigned long> clients;
|
||||||
unsigned long totClients = 0;
|
unsigned long totClients = 0;
|
||||||
unsigned int t = Util::epoch() - 15;
|
unsigned int t = Util::epoch() - STATS_DELAY;
|
||||||
//check all sessions
|
//check all sessions
|
||||||
if (sessions.size()){
|
if (sessions.size()){
|
||||||
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
||||||
|
@ -1117,7 +1122,7 @@ void Controller::handlePrometheus(HTTP::Parser & H, Socket::Connection & conn, i
|
||||||
//collect the data first
|
//collect the data first
|
||||||
std::map<std::string, unsigned long> clients;
|
std::map<std::string, unsigned long> clients;
|
||||||
unsigned long totClients = 0;
|
unsigned long totClients = 0;
|
||||||
unsigned int t = Util::epoch() - 15;
|
unsigned int t = Util::epoch() - STATS_DELAY;
|
||||||
//check all sessions
|
//check all sessions
|
||||||
if (sessions.size()){
|
if (sessions.size()){
|
||||||
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
||||||
|
|
Loading…
Add table
Reference in a new issue