@Override
public void onNext(Statistics stats) {
Map<String, Object> memStat = stats.getMemoryStats();
Map<String, Object> blkioStat = stats.getBlkioStats();
Map<String, Object> netStat = stats.getNetworks();
double cpuPercent = 0.0;
if (this.preStats != null) {
cpuPercent = calculateCpuPercentUnix(this.preStats, stats);
}
int[] netIO = calculateNetwork(netStat);
int[] memUsageLimit = calculateMemory(memStat);
int[] blockIo = calculateBlock(blkioStat);
logHost.log(Level.INFO, "\n%s(%s)\nCPU %4.3f%% | MEM %4.3f%% (%d KB / %d KB) | NET %d KB / %d KB | BLOCK %d KB / %d KB",
this.containerId, this.containerUri,
cpuPercent,
(memUsageLimit[0] * 1.0 / memUsageLimit[1] * 1.0) * 100, memUsageLimit[0] / 1024, memUsageLimit[1] / 1024,
netIO[0] / 1024, netIO[1] / 1024,
blockIo[0] / 1024, blockIo[1] / 1024);
this.preStats = stats;
this.countDownLatch.countDown();
}