5 #include <mist/tinythread.h> 10 #define STAT_CUTOFF 600 28 sessIndex(std::string host,
unsigned int crc, std::string streamName, std::string connector);
36 bool operator== (
const sessIndex &o)
const;
37 bool operator!= (
const sessIndex &o)
const;
38 bool operator> (
const sessIndex &o)
const;
39 bool operator<= (
const sessIndex &o)
const;
40 bool operator< (
const sessIndex &o)
const;
41 bool operator>= (
const sessIndex &o)
const;
48 bool hasDataFor(
unsigned long long);
49 statLog & getDataFor(
unsigned long long);
50 std::map<unsigned long long, statLog>
log;
64 void wipeOld(
unsigned long long);
65 void finish(
unsigned long index);
66 void switchOverTo(
statSession & newSess,
unsigned long index);
68 unsigned long long getStart();
69 unsigned long long getEnd();
70 bool hasDataFor(
unsigned long long time);
72 long long getConnTime(
unsigned long long time);
73 long long getLastSecond(
unsigned long long time);
74 long long getDown(
unsigned long long time);
75 long long getUp(
unsigned long long time);
76 long long getBpsDown(
unsigned long long time);
77 long long getBpsUp(
unsigned long long time);
78 long long getBpsDown(
unsigned long long start,
unsigned long long end);
79 long long getBpsUp(
unsigned long long start,
unsigned long long end);
83 extern std::map<sessIndex, statSession>
sessions;
void killStatistics(char *data, size_t len, unsigned int id)
Forces a disconnect to all users.
Definition: controller_statistics.cpp:92
unsigned long long lastSec
Definition: controller_statistics.h:58
void fillClients(JSON::Value &req, JSON::Value &rep)
This takes a "clients" request, and fills in the response data.
Definition: controller_statistics.cpp:513
Holds everything unique to the controller.
Definition: controller_api.h:4
A session class that keeps track of both current and archived connections.
Definition: controller_statistics.h:55
unsigned long long firstSec
Definition: controller_statistics.h:57
char sync
Definition: controller_statistics.h:61
Definition: controller_statistics.h:17
std::map< unsigned long, sessIndex > connToSession
Map of socket IDs to session info.
Definition: controller_statistics.cpp:33
long time
Definition: controller_statistics.h:18
A JSON::Value is either a string or an integer, but may also be an object, array or null...
Definition: json.h:21
void fillTotals(JSON::Value &req, JSON::Value &rep)
This takes a "totals" request, and fills in the response data.
Definition: controller_statistics.cpp:752
unsigned int crc
Definition: controller_statistics.h:32
std::map< unsigned long, statStorage > curConns
Definition: controller_statistics.h:60
std::map< sessIndex, statSession > sessions
list of sessions that have statistics data available
Definition: controller_statistics.cpp:32
This is a comparison and storage class that keeps sessions apart from each other. ...
Definition: controller_statistics.h:26
Definition: controller_statistics.h:45
long long up
Definition: controller_statistics.h:21
long lastSecond
Definition: controller_statistics.h:19
std::string connector
Definition: controller_statistics.h:34
std::string streamName
Definition: controller_statistics.h:33
void fillActive(JSON::Value &req, JSON::Value &rep, bool onlyNow=false)
This takes a "active_streams" request, and fills in the response data.
Definition: controller_statistics.cpp:637
std::map< unsigned long long, statLog > log
Definition: controller_statistics.h:50
tthread::mutex statsMutex
Definition: controller_statistics.cpp:35
std::string host
Definition: controller_statistics.h:31
bool killOnExit
Definition: controller_statistics.cpp:34
A class used for the exchange of statistics over shared memory.
Definition: shared_memory.h:20
void parseStatistics(char *data, size_t len, unsigned int id)
This function is called by the shared memory page that holds statistics.
Definition: controller_statistics.cpp:435
void SharedMemStats(void *config)
This function runs as a thread and roughly once per second retrieves statistics from all connected cl...
Definition: controller_statistics.cpp:99
long long down
Definition: controller_statistics.h:20
bool hasViewers(std::string streamName)
Returns true if this stream has at least one connected client.
Definition: controller_statistics.cpp:466
std::deque< statStorage > oldConns
Definition: controller_statistics.h:59