mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine perf stat
This commit is contained in:
parent
c93cd86ce4
commit
ce36a970ff
2 changed files with 31 additions and 16 deletions
|
@ -2013,6 +2013,7 @@ srs_error_t SrsUdpMuxSender::cycle()
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
uint64_t nn_msgs = 0; uint64_t nn_msgs_last = 0; int nn_msgs_max = 0;
|
||||
uint64_t nn_bytes = 0; int nn_bytes_max = 0;
|
||||
uint64_t nn_gso_msgs = 0; uint64_t nn_gso_iovs = 0; int nn_gso_msgs_max = 0; int nn_gso_iovs_max = 0;
|
||||
int nn_loop = 0; int nn_wait = 0;
|
||||
srs_utime_t time_last = srs_get_system_time();
|
||||
|
@ -2044,21 +2045,8 @@ srs_error_t SrsUdpMuxSender::cycle()
|
|||
cache_pos = 0;
|
||||
|
||||
int gso_pos = 0;
|
||||
int nn_writen = 0;
|
||||
if (pos > 0) {
|
||||
// Collect informations for GSO.
|
||||
if (stat_enabled) {
|
||||
// For shared GSO cache, stat the messages.
|
||||
// @see https://linux.die.net/man/2/sendmmsg
|
||||
// @see https://linux.die.net/man/2/sendmsg
|
||||
for (int i = 0; i < pos; i++) {
|
||||
mmsghdr* mhdr = &hotspot[i];
|
||||
|
||||
int real_iovs = mhdr->msg_hdr.msg_iovlen;
|
||||
gso_pos++; nn_gso_msgs++; nn_gso_iovs += real_iovs;
|
||||
gso_iovs += real_iovs;
|
||||
}
|
||||
}
|
||||
|
||||
// Send out all messages.
|
||||
// @see https://linux.die.net/man/2/sendmmsg
|
||||
// @see https://linux.die.net/man/2/sendmsg
|
||||
|
@ -2076,6 +2064,22 @@ srs_error_t SrsUdpMuxSender::cycle()
|
|||
stat->perf_on_sendmmsg_packets(vlen);
|
||||
}
|
||||
}
|
||||
|
||||
// Collect informations for GSO.
|
||||
if (stat_enabled) {
|
||||
// Stat the messages, iovs and bytes.
|
||||
// @see https://linux.die.net/man/2/sendmmsg
|
||||
// @see https://linux.die.net/man/2/sendmsg
|
||||
for (int i = 0; i < pos; i++) {
|
||||
mmsghdr* mhdr = &hotspot[i];
|
||||
|
||||
nn_writen += (int)mhdr->msg_len;
|
||||
|
||||
int real_iovs = mhdr->msg_hdr.msg_iovlen;
|
||||
gso_pos++; nn_gso_msgs++; nn_gso_iovs += real_iovs;
|
||||
gso_iovs += real_iovs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!stat_enabled) {
|
||||
|
@ -2085,6 +2089,8 @@ srs_error_t SrsUdpMuxSender::cycle()
|
|||
// Increase total messages.
|
||||
nn_msgs += pos + gso_iovs;
|
||||
nn_msgs_max = srs_max(pos, nn_msgs_max);
|
||||
nn_bytes += nn_writen;
|
||||
nn_bytes_max = srs_max(nn_bytes_max, nn_writen);
|
||||
nn_gso_msgs_max = srs_max(gso_pos, nn_gso_msgs_max);
|
||||
nn_gso_iovs_max = srs_max(gso_iovs, nn_gso_iovs_max);
|
||||
|
||||
|
@ -2115,12 +2121,13 @@ srs_error_t SrsUdpMuxSender::cycle()
|
|||
nn_cache += hdr->msg_hdr.msg_iovlen;
|
||||
}
|
||||
|
||||
srs_trace("-> RTC SEND #%d, sessions %d, udp %d/%d/%" PRId64 ", gso %d/%d/%" PRId64 ", iovs %d/%d/%" PRId64 ", pps %d/%d%s, cache %d/%d",
|
||||
srs_trace("-> RTC SEND #%d, sessions %d, udp %d/%d/%" PRId64 ", gso %d/%d/%" PRId64 ", iovs %d/%d/%" PRId64 ", pps %d/%d%s, cache %d/%d, bytes %d/%" PRId64,
|
||||
srs_netfd_fileno(lfd), (int)server->nn_sessions(), pos, nn_msgs_max, nn_msgs, gso_pos, nn_gso_msgs_max, nn_gso_msgs, gso_iovs,
|
||||
nn_gso_iovs_max, nn_gso_iovs, pps_average, pps_last, pps_unit.c_str(), (int)hotspot.size(), nn_cache);
|
||||
nn_gso_iovs_max, nn_gso_iovs, pps_average, pps_last, pps_unit.c_str(), (int)hotspot.size(), nn_cache, nn_bytes_max, nn_bytes);
|
||||
nn_msgs_last = nn_msgs; time_last = srs_get_system_time();
|
||||
nn_loop = nn_wait = nn_msgs_max = 0;
|
||||
nn_gso_msgs_max = 0; nn_gso_iovs_max = 0;
|
||||
nn_bytes_max = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue