Search in sources :

Example 1 with Frequency

use of net.i2p.stat.Frequency in project i2p.i2p by i2p.

the class StatsGenerator method renderFrequency.

private void renderFrequency(String name, StringBuilder buf) {
    FrequencyStat freq = _context.statManager().getFrequency(name);
    buf.append("<i>");
    buf.append(freq.getDescription());
    buf.append("</i><br>");
    if (freq.getEventCount() <= 0) {
        buf.append("<ul><li class=\"noevents\">").append(_t("No lifetime events")).append("</li></ul>\n");
        return;
    }
    long uptime = _context.router().getUptime();
    long[] periods = freq.getPeriods();
    Arrays.sort(periods);
    buf.append("<ul>");
    for (int i = 0; i < periods.length; i++) {
        if (periods[i] > uptime)
            break;
        buf.append("<li>");
        renderPeriod(buf, periods[i], _t("frequency"));
        Frequency curFreq = freq.getFrequency(periods[i]);
        buf.append(DataHelper.formatDuration2(Math.round(curFreq.getAverageInterval())));
        buf.append("; ");
        buf.append(_t("Rolling average events per period"));
        buf.append(": ");
        buf.append(num(curFreq.getAverageEventsPerPeriod()));
        buf.append("; ");
        buf.append(_t("Highest events per period"));
        buf.append(": ");
        buf.append(num(curFreq.getMaxAverageEventsPerPeriod()));
        buf.append("; ");
        // if (showAll && (curFreq.getMaxAverageEventsPerPeriod() > 0) && (curFreq.getAverageEventsPerPeriod() > 0) ) {
        // buf.append("(current is ");
        // buf.append(pct(curFreq.getAverageEventsPerPeriod()/curFreq.getMaxAverageEventsPerPeriod()));
        // buf.append(" of max)");
        // }
        // buf.append(" <i>avg interval between updates:</i> (").append(num(curFreq.getAverageInterval())).append("ms, min ");
        // buf.append(num(curFreq.getMinAverageInterval())).append("ms)");
        buf.append(_t("Lifetime average events per period")).append(": ");
        buf.append(num(curFreq.getStrictAverageEventsPerPeriod()));
        buf.append("</li>\n");
    }
    // Display the strict average
    buf.append("<li><b>").append(_t("Lifetime average frequency")).append(":</b> ");
    buf.append(DataHelper.formatDuration2(freq.getFrequency()));
    buf.append(" (");
    buf.append(ngettext("1 event", "{0} events", (int) freq.getEventCount()));
    buf.append(")</li></ul><br>\n");
}
Also used : FrequencyStat(net.i2p.stat.FrequencyStat) Frequency(net.i2p.stat.Frequency)

Aggregations

Frequency (net.i2p.stat.Frequency)1 FrequencyStat (net.i2p.stat.FrequencyStat)1