mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge 4.0release.
This commit is contained in:
commit
3da0b57121
9 changed files with 160 additions and 34 deletions
|
@ -206,9 +206,9 @@ SrsStatisticClient::SrsStatisticClient()
|
|||
|
||||
SrsStatisticClient::~SrsStatisticClient()
|
||||
{
|
||||
srs_freep(req);
|
||||
srs_freep(kbps);
|
||||
srs_freep(clk);
|
||||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsStatisticClient::dumps(SrsJsonObject* obj)
|
||||
|
@ -242,8 +242,6 @@ SrsStatistic* SrsStatistic::_instance = NULL;
|
|||
|
||||
SrsStatistic::SrsStatistic()
|
||||
{
|
||||
_server_id = srs_generate_stat_vid();
|
||||
|
||||
clk = new SrsWallClock();
|
||||
kbps = new SrsKbps(clk);
|
||||
kbps->set_io(NULL, NULL);
|
||||
|
@ -525,7 +523,10 @@ SrsKbps* SrsStatistic::kbps_sample()
|
|||
|
||||
std::string SrsStatistic::server_id()
|
||||
{
|
||||
return _server_id;
|
||||
if (server_id_.empty()) {
|
||||
server_id_ = _srs_config->get_server_id();
|
||||
}
|
||||
return server_id_;
|
||||
}
|
||||
|
||||
srs_error_t SrsStatistic::dumps_vhosts(SrsJsonArray* arr)
|
||||
|
@ -593,6 +594,22 @@ srs_error_t SrsStatistic::dumps_clients(SrsJsonArray* arr, int start, int count)
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsStatistic::dumps_hints_kv(std::stringstream & ss)
|
||||
{
|
||||
if (!streams.empty()) {
|
||||
ss << "&streams=" << streams.size();
|
||||
}
|
||||
if (!clients.empty()) {
|
||||
ss << "&clients=" << clients.size();
|
||||
}
|
||||
if (kbps->get_recv_kbps_30s()) {
|
||||
ss << "&recv=" << kbps->get_recv_kbps_30s();
|
||||
}
|
||||
if (kbps->get_send_kbps_30s()) {
|
||||
ss << "&send=" << kbps->get_send_kbps_30s();
|
||||
}
|
||||
}
|
||||
|
||||
SrsStatisticVhost* SrsStatistic::create_vhost(SrsRequest* req)
|
||||
{
|
||||
SrsStatisticVhost* vhost = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue