Counters mapCounters = job.getMapCounters();
Counters reduceCounters = job.getReduceCounters();
if (totalCounters != null) {
for (String groupName : totalCounters.getGroupNames()) {
CounterGroup totalGroup = totalCounters.getGroup(groupName);
CounterGroup mapGroup = mapCounters.getGroup(groupName);
CounterGroup reduceGroup = reduceCounters.getGroup(groupName);
Format decimal = new DecimalFormat();
boolean isFirst = true;
Iterator<Counter> ctrItr = totalGroup.iterator();
while(ctrItr.hasNext()) {
Counter counter = ctrItr.next();
String name = counter.getName();
String mapValue =
decimal.format(mapGroup.findCounter(name).getValue());
String reduceValue =
decimal.format(reduceGroup.findCounter(name).getValue());
String totalValue =
decimal.format(counter.getValue());
out.write("\n <tr>\n");