1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: Stat the UDP packets and addresses

This commit is contained in:
winlin 2021-02-07 20:12:54 +08:00
parent 2b73c1c7e6
commit ca3ac467a3
2 changed files with 25 additions and 1 deletions

View file

@ -45,6 +45,10 @@ using namespace std;
#include <srs_app_rtc_api.hpp>
#include <srs_protocol_utility.hpp>
extern SrsPps* _srs_pps_pkts;
extern SrsPps* _srs_pps_addrs;
extern SrsPps* _srs_pps_fast_addrs;
SrsRtcBlackhole::SrsRtcBlackhole()
{
blackhole = false;
@ -637,8 +641,15 @@ srs_error_t SrsRtcServer::notify(int type, srs_utime_t interval, srs_utime_t tic
SrsProcSelfStat* u = srs_get_self_proc_stat();
// Resident Set Size: number of pages the process has in real memory.
int memory = (int)(u->rss * 4 / 1024);
// Update the pps stat for UDP socket and adddresses.
_srs_pps_pkts->update(); _srs_pps_addrs->update(); _srs_pps_fast_addrs->update();
// TODO: FIXME: Show more data for RTC server.
srs_trace("RTC: Server conns=%u, cpu=%.2f%%, rss=%dMB", nn_rtc_conns, u->percent * 100, memory);
srs_trace("RTC: Server conns=%u, cpu=%.2f%%, rss=%dMB, pkts=%d, addrs=%d,%d",
nn_rtc_conns, u->percent * 100, memory,
_srs_pps_pkts->r10s(), _srs_pps_addrs->r10s(), _srs_pps_fast_addrs->r10s()
);
return err;
}