You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ISrsProtocolStatistic interface provides the number of bytes transferred at the class protocol layer, including the number of bytes received and sent.
Its implicit meaning is that each time this interface is called, it returns the number of bytes already transferred.
SrsKbps class mainly provides the byte difference over a certain period of time, as well as the rate (Kbps).
This class can also provide the historical number of bytes, including the total number of bytes after switching to the underlying IO.
In other words:
kbps->set(io0, io0)
kbps->set(io1, io1)
This SrsKbps class is used to track historical data, allowing for the aggregation of data from multiple IOs. For example, it can be used to calculate the total byte data for a client connecting to different servers.
Based on this consideration, SrsKbps inherits from ISrsProtocolStatistic to provide byte statistics.
However, there is a special requirement for the functions in ISrsKbps. They must be called after invoking the sample() function because the sample() function needs to be called to update the data for Kbps and refresh its cache.
public:
/**
* get the total send/recv bytes, from the startup of the oldest io.
* @remark, use sample() to update data.
*/
virtual int64_t get_cur_send_bytes();
virtual int64_t get_cur_recv_bytes();
Therefore, the behavior of SrsKbps is different from what is defined in the interface.
This can result in outdated data if the functions in the interface are called without first sampling.
In simpler terms, it means that the bandwidth calculation may be underestimated. If the interface is called in two different places, such as for billing logs and access logs, there may be a difference of one sampling period.
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered:
winlinvip
changed the title
SrsKbps的接口错误,行为不符合ISrsProtocolStatistic的规范
SrsKbps interface error, behavior does not comply with the specification of ISrsProtocolStatistic.
Jul 28, 2023
ISrsProtocolStatistic interface provides the number of bytes transferred at the class protocol layer, including the number of bytes received and sent.
Its implicit meaning is that each time this interface is called, it returns the number of bytes already transferred.
SrsKbps class mainly provides the byte difference over a certain period of time, as well as the rate (Kbps).
This class can also provide the historical number of bytes, including the total number of bytes after switching to the underlying IO.
In other words:
This SrsKbps class is used to track historical data, allowing for the aggregation of data from multiple IOs. For example, it can be used to calculate the total byte data for a client connecting to different servers.
Based on this consideration, SrsKbps inherits from ISrsProtocolStatistic to provide byte statistics.
However, there is a special requirement for the functions in ISrsKbps. They must be called after invoking the sample() function because the sample() function needs to be called to update the data for Kbps and refresh its cache.
Therefore, the behavior of SrsKbps is different from what is defined in the interface.
This can result in outdated data if the functions in the interface are called without first sampling.
In simpler terms, it means that the bandwidth calculation may be underestimated. If the interface is called in two different places, such as for billing logs and access logs, there may be a difference of one sampling period.
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: