伙计们,我正在阅读 / proc / net / dev 来接收和传输的字节数 我能够计算in_traffic,out_traffic但速度无法找到
delta_time是上次检查unix时间和当前unix时间的差异b / w
in_traffic = ( ( (new_inbytes - prev_inbytes) * 8 ) / (delta_time) )
out_traffic = ( ( (new_outbytes - prev_outbytes) * 8) / (delta_time))
if speed > 0{
in_utilization = in_traffic / (speed * 10000)
out_utilization = out_traffic / (speed * 10000)
}
请帮忙, 谢谢