com.purej.vminspect.html.StatisticsMainView Maven / Gradle / Ivy
// Copyright (c), 2013, adopus consulting GmbH Switzerland, all rights reserved.
package com.purej.vminspect.html;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import com.purej.vminspect.data.statistics.Range;
import com.purej.vminspect.data.statistics.Statistics;
import com.purej.vminspect.data.statistics.StatisticsCollector;
/**
* Displays the statistics overview page with all statistics available.
*
* @author Stefan Mueller
*/
public final class StatisticsMainView extends AbstractStatisticsView {
private final StatisticsCollector _statistics;
/**
* Creates a new instance of this view.
*/
public StatisticsMainView(StringBuilder output, StatisticsCollector statistics, Range range) {
super(output, range);
_statistics = statistics;
}
@Override
public void render() throws IOException {
writeln("" + img("icons/charts-24.png", "Statistics") + " Statistics Overview
");
writeln("");
writeChoosePeriodLinks(null, -1, -1);
writeln("
");
writeGraphs(_statistics.getStatistics());
writeln("");
writeDurationAndOverhead();
}
private void writeGraphs(List statistics) throws IOException {
for (int i = 0; i < statistics.size(); i++) {
Statistics stats = statistics.get(i);
String params = statisticsGraphParams(stats.getName(), 200, 50);
String img = "";
String statsParams = addRangeParams(statisticsPageParams("statsDetail=" + stats.getName(), "statsWidth=1000", "statsHeight=400"));
writeln(lnk(statsParams, img));
write(" ");
if ((i + 1) % 3 == 0) {
writeln("
");
}
}
}
private void writeDurationAndOverhead() throws IOException {
writeln("");
writeln("
");
writeln("Statistics collection frequency: " + formatNumber(_statistics.getCollectionFrequencyMillis()) + "ms");
writeln("
Last statistics collection time: " + formatDateTime(new Date(_statistics.getLastCollectTimestamp())));
writeln("
Last statistics collection duration: " + formatNumber(_statistics.getLastCollectDurationMs()));
if (_statistics.getStatisticsStorageDir() == null) {
writeln("
Statistics memory overhead: " + formatMb(_statistics.getEstimatedMemorySize() / 1024d / 1024d));
writeln("
Note: No statistics directory configured, measuring statistics in-memory without persistence!");
}
else {
writeln("
Statistics directory: " + _statistics.getStatisticsStorageDir());
writeln("
Statistics disk usage: " + formatMb(_statistics.getDiskUsage() / 1024d / 1024d));
}
writeln("");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy