Search in sources :

Example 1 with StatManager

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;
}
Also used : RateStat(net.i2p.stat.RateStat) StatManager(net.i2p.stat.StatManager)

Example 2 with StatManager

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);
}
Also used : RateStat(net.i2p.stat.RateStat) StatManager(net.i2p.stat.StatManager)

Aggregations

RateStat (net.i2p.stat.RateStat)2 StatManager (net.i2p.stat.StatManager)2