code: @Override
    public synchronized void write(DataOutput out) throws IOException {
      out.writeInt(groups.size());
      for (org.apache.hadoop.mapreduce.CounterGroup group: groups.values()) {
        Text.writeString(out, group.getName());
        group.write(out);
      }
    }
docs: Write the set of groups.
  The external format is:
  #groups (groupName group)*
  
  i.e. the number of groups followed by 0 or more groups, where each
  group is of the form:
  
  groupDisplayName #counters (false | true counter)*
  
  where each counter is of the form:
  
  name (false | true displayName) value