Fix GSO stat bug

pull/1753/head
winlin 5 years ago
parent dd7b5cf53f
commit c143c80fd6

@ -46,41 +46,45 @@ keys = ['lt_2', 'lt_3', 'lt_5', 'lt_9', 'lt_16', 'lt_32', 'lt_64', 'lt_128', 'lt
print ""
print("AV---Frames"),
p = obj['data']['avframes']
for k in keys:
k2 = '%s'%(k)
p = obj['data']['avframes']
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
print ""
print("RTC--Frames"),
p = obj['data']['rtc']
for k in keys:
k2 = '%s'%(k)
p = obj['data']['rtc']
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
print ""
print("RTP-Packets"),
p = obj['data']['rtp']
for k in keys:
k2 = '%s'%(k)
p = obj['data']['rtp']
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
print ""
print("GSO-Packets"),
p = obj['data']['gso']
for k in keys:
k2 = '%s'%(k)
p = obj['data']['gso']
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),

@ -652,11 +652,17 @@ srs_error_t SrsRtcSenderThread::cycle()
// Stat the original RAW AV frame, maybe h264+aac.
stat->perf_on_msgs(msg_count);
// Stat the RTC packets, RAW AV frame, maybe h.264+opus.
stat->perf_on_rtc_packets(srs_max(pkts.nn_audios, pkts.nn_extras) + pkts.nn_videos);
int nn_rtc_packets = srs_max(pkts.nn_audios, pkts.nn_extras) + pkts.nn_videos;
stat->perf_on_rtc_packets(nn_rtc_packets);
// Stat the RAW RTP packets, which maybe group by GSO.
stat->perf_on_rtp_packets(pkts.packets.size());
// Stat the RTP packets going into kernel.
stat->perf_on_gso_packets(pkts.nn_rtp_pkts);
#if defined(SRS_DEBUG)
srs_trace("RTC PLAY packets, msgs %d/%d, rtp %d, gso %d, %d audios, %d extras, %d videos, %d samples, %d bytes",
msg_count, nn_rtc_packets, pkts.packets.size(), pkts.nn_rtp_pkts, pkts.nn_audios, pkts.nn_extras, pkts.nn_videos,
pkts.nn_samples, pkts.nn_bytes);
#endif
pprint->elapse();
if (pprint->can_print()) {
@ -1014,7 +1020,7 @@ srs_error_t SrsRtcSenderThread::send_packets_gso(SrsUdpMuxSocket* skt, SrsRtcPac
}
#if defined(SRS_DEBUG)
srs_trace("Summary packets, rtp %d/%d, videos %d/%d, audios %d/%d", packets.packets.size(),
srs_trace("RTC PLAY summary, rtp %d/%d, videos %d/%d, audios %d/%d", packets.packets.size(),
packets.nn_rtp_pkts, packets.nn_videos, packets.nn_samples, packets.nn_audios, packets.nn_extras);
#endif

@ -236,6 +236,8 @@ srs_error_t SrsStatisticClient::dumps(SrsJsonObject* obj)
SrsStatisticCategory::SrsStatisticCategory()
{
nn = 0;
a = 0;
b = 0;
c = 0;
@ -685,6 +687,8 @@ void SrsStatistic::perf_on_packets(SrsStatisticCategory* p, int nb_msgs)
} else {
p->j++;
}
p->nn += nb_msgs;
}
srs_error_t SrsStatistic::dumps_perf(SrsStatisticCategory* p, SrsJsonObject* obj)
@ -715,6 +719,8 @@ srs_error_t SrsStatistic::dumps_perf(SrsStatisticCategory* p, SrsJsonObject* obj
if (p->i) obj->set("lt_256", SrsJsonAny::integer(p->i));
if (p->j) obj->set("gt_256", SrsJsonAny::integer(p->j));
obj->set("nn", SrsJsonAny::integer(p->nn));
return err;
}

@ -124,6 +124,8 @@ public:
class SrsStatisticCategory
{
public:
uint64_t nn;
public:
uint64_t a;
uint64_t b;

Loading…
Cancel
Save