use of net.i2p.stat.StatManager in project i2p.i2p by i2p.
the class Router method get1mRateIn.
/**
* Inbound rate in bytes per second
*/
public int get1mRateIn() {
StatManager mgr = _context.statManager();
RateStat rs = mgr.getRate("bw.recvRate");
int recv = 0;
if (rs != null)
recv = (int) rs.getRate(1 * 60 * 1000).getAverageValue();
return recv;
}
use of net.i2p.stat.StatManager in project i2p.i2p by i2p.
the class Router method get1mRate.
/**
* When outboundOnly is false, outbound rate in bytes per second.
* When true, max of inbound and outbound rate in bytes per second.
*/
public int get1mRate(boolean outboundOnly) {
int send = 0;
StatManager mgr = _context.statManager();
RateStat rs = mgr.getRate("bw.sendRate");
if (rs != null)
send = (int) rs.getRate(1 * 60 * 1000).getAverageValue();
if (outboundOnly)
return send;
int recv = 0;
rs = mgr.getRate("bw.recvRate");
if (rs != null)
recv = (int) rs.getRate(1 * 60 * 1000).getAverageValue();
return Math.max(send, recv);
}
Aggregations