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

Add api to stat mw iovec

This commit is contained in:
winlin 2020-03-27 13:37:39 +08:00
parent b3b76b0ca6
commit 90a39ec46d
9 changed files with 335 additions and 7 deletions

View file

@ -122,7 +122,26 @@ public:
virtual srs_error_t dumps(SrsJsonObject* obj);
};
class SrsStatistic
class SrsStatisticCategory
{
public:
uint64_t a;
uint64_t b;
uint64_t c;
uint64_t d;
uint64_t e;
public:
uint64_t f;
uint64_t g;
uint64_t h;
uint64_t i;
uint64_t j;
public:
SrsStatisticCategory();
virtual ~SrsStatisticCategory();
};
class SrsStatistic : public ISrsProtocolPerf
{
private:
static SrsStatistic *_instance;
@ -146,6 +165,10 @@ private:
// The server total kbps.
SrsKbps* kbps;
SrsWallClock* clk;
// The perf stat for mw(merged write).
SrsStatisticCategory* perf_iovs;
SrsStatisticCategory* perf_msgs;
SrsStatisticCategory* perf_sys;
private:
SrsStatistic();
virtual ~SrsStatistic();
@ -203,6 +226,15 @@ public:
// @param start the start index, from 0.
// @param count the max count of clients to dump.
virtual srs_error_t dumps_clients(SrsJsonArray* arr, int start, int count);
public:
// Stat for packets merged written, nb_msgs is the number of RTMP messages,
// bytes_msgs is the total bytes of RTMP messages, nb_iovs is the total number of iovec.
virtual void perf_mw_on_msgs(int nb_msgs, int bytes_msgs, int nb_iovs);
// Stat for packets merged written, nb_pkts is the number of or chunk packets,
// bytes_pkts is the total bytes of or chunk packets, nb_iovs is the total number of iovec.
virtual void perf_mw_on_packets(int nb_pkts, int bytes_pkts, int nb_iovs);
// Dumps the perf statistic data, for performance analysis.
virtual srs_error_t dumps_perf_mw(SrsJsonObject* obj);
private:
virtual SrsStatisticVhost* create_vhost(SrsRequest* req);
virtual SrsStatisticStream* create_stream(SrsStatisticVhost* vhost, SrsRequest* req);