LongSumAggregator.class);
}
@Override
public void preSuperstep() {
LongSumAggregator superstepBytesAggregator =
(LongSumAggregator) getAggregator(AGG_SUPERSTEP_TOTAL_BYTES);
LongSumAggregator superstepMessagesAggregator =
(LongSumAggregator) getAggregator(AGG_SUPERSTEP_TOTAL_MESSAGES);
LongSumAggregator superstepMillisAggregator =
(LongSumAggregator) getAggregator(AGG_SUPERSTEP_TOTAL_MILLIS);
LongSumAggregator workersAggregator =
(LongSumAggregator) getAggregator(WORKERS);
// For timing and tracking the supersteps
// - superstep 0 starts the time, but cannot display any stats
// since nothing has been aggregated yet
// - supersteps > 0 can display the stats
if (getSuperstep() == 0) {
startSuperstepMillis = System.currentTimeMillis();
} else {
totalBytes +=
superstepBytesAggregator.getAggregatedValue().get();
totalMessages +=
superstepMessagesAggregator.getAggregatedValue().get();
totalMillis +=
superstepMillisAggregator.getAggregatedValue().get();
double superstepMegabytesPerSecond =
superstepBytesAggregator.getAggregatedValue().get() *
workersAggregator.getAggregatedValue().get() *
1000d / 1024d / 1024d /
superstepMillisAggregator.getAggregatedValue().get();
double megabytesPerSecond = totalBytes *
workersAggregator.getAggregatedValue().get() *
1000d / 1024d / 1024d / totalMillis;
double superstepMessagesPerSecond =
superstepMessagesAggregator.getAggregatedValue().get() *
workersAggregator.getAggregatedValue().get() * 1000d /
superstepMillisAggregator.getAggregatedValue().get();
double messagesPerSecond = totalMessages *
workersAggregator.getAggregatedValue().get() * 1000d /
totalMillis;
if (LOG.isInfoEnabled()) {
LOG.info("Outputing statistics for superstep " +
getSuperstep());
LOG.info(AGG_SUPERSTEP_TOTAL_BYTES + " : " +
superstepBytesAggregator.getAggregatedValue());
LOG.info(AGG_TOTAL_BYTES + " : " + totalBytes);
LOG.info(AGG_SUPERSTEP_TOTAL_MESSAGES + " : " +
superstepMessagesAggregator.getAggregatedValue());
LOG.info(AGG_TOTAL_MESSAGES + " : " + totalMessages);
LOG.info(AGG_SUPERSTEP_TOTAL_MILLIS + " : " +
superstepMillisAggregator.getAggregatedValue());
LOG.info(AGG_TOTAL_MILLIS + " : " + totalMillis);
LOG.info(WORKERS + " : " +
workersAggregator.getAggregatedValue());
LOG.info("Superstep megabytes / second = " +
superstepMegabytesPerSecond);
LOG.info("Total megabytes / second = " +
megabytesPerSecond);
LOG.info("Superstep messages / second = " +
superstepMessagesPerSecond);
LOG.info("Total messages / second = " +
messagesPerSecond);
LOG.info("Superstep megabytes / second / worker = " +
superstepMegabytesPerSecond /
workersAggregator.getAggregatedValue().get());
LOG.info("Total megabytes / second / worker = " +
megabytesPerSecond /
workersAggregator.getAggregatedValue().get());
LOG.info("Superstep messages / second / worker = " +
superstepMessagesPerSecond /
workersAggregator.getAggregatedValue().get());
LOG.info("Total messages / second / worker = " +
messagesPerSecond /
workersAggregator.getAggregatedValue().get());
}
}
superstepBytesAggregator.setAggregatedValue(
new LongWritable(0L));
superstepMessagesAggregator.setAggregatedValue(
new LongWritable(0L));
workersAggregator.setAggregatedValue(
new LongWritable(1L));
useAggregator(AGG_SUPERSTEP_TOTAL_BYTES);
useAggregator(AGG_SUPERSTEP_TOTAL_MILLIS);
useAggregator(AGG_SUPERSTEP_TOTAL_MESSAGES);
useAggregator(WORKERS);