private void parseAndAddJobCounters(Hashtable<Enum, String> job, String counters) throws ParseException {
    Counters cnt = Counters.fromEscapedCompactString(counters);
    for (java.util.Iterator<Counters.Group> grps = cnt.iterator(); grps.hasNext(); ) {
      Counters.Group grp = grps.next();
      //String groupname = "<" + grp.getName() + ">::<" + grp.getDisplayName() + ">";
      for (java.util.Iterator<Counters.Counter> mycounters = grp.iterator(); mycounters.hasNext(); ) {
        Counters.Counter counter = mycounters.next();
        //String countername = "<"+counter.getName()+">::<"+counter.getDisplayName()+">::<"+counter.getValue()+">";
        //System.err.println("groupName:"+groupname+",countername: "+countername);
        String countername = grp.getDisplayName()+"."+counter.getDisplayName();
        String value = (new Long(counter.getValue())).toString();
        String[] parts = {countername,value};
        //System.err.println("part0:<"+parts[0]+">,:part1 <"+parts[1]+">");
        if (parts[0].equals("FileSystemCounters.FILE_BYTES_READ")) {
          job.put(JobKeys.FILE_BYTES_READ, parts[1]);
        } else if (parts[0].equals("FileSystemCounters.FILE_BYTES_WRITTEN")) {
          job.put(JobKeys.FILE_BYTES_WRITTEN, parts[1]);
        } else if (parts[0].equals("FileSystemCounters.HDFS_BYTES_READ")) {
          job.put(JobKeys.HDFS_BYTES_READ, parts[1]);
        } else if (parts[0].equals("FileSystemCounters.HDFS_BYTES_WRITTEN")) {
          job.put(JobKeys.HDFS_BYTES_WRITTEN, parts[1]);
        } else if (parts[0].equals("Job Counters .Launched map tasks")) {
          job.put(JobKeys.LAUNCHED_MAPS, parts[1]);
        } else if (parts[0].equals("Job Counters .Launched reduce tasks")) {
          job.put(JobKeys.LAUNCHED_REDUCES, parts[1]);
        } else if (parts[0].equals("Job Counters .Data-local map tasks")) {
          job.put(JobKeys.DATALOCAL_MAPS, parts[1]);
        } else if (parts[0].equals("Job Counters .Rack-local map tasks")) {
          job.put(JobKeys.RACKLOCAL_MAPS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Map input records")) {
          job.put(JobKeys.MAP_INPUT_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Map output records")) {
          job.put(JobKeys.MAP_OUTPUT_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Map input bytes")) {
          job.put(JobKeys.MAP_INPUT_BYTES, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Map output bytes")) {
          job.put(JobKeys.MAP_OUTPUT_BYTES, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Combine input records")) {
          job.put(JobKeys.COMBINE_INPUT_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Combine output records")) {
          job.put(JobKeys.COMBINE_OUTPUT_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Reduce input groups")) {
          job.put(JobKeys.REDUCE_INPUT_GROUPS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Reduce input records")) {
          job.put(JobKeys.REDUCE_INPUT_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Reduce output records")) {
          job.put(JobKeys.REDUCE_OUTPUT_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Spilled Records")) {
          job.put(JobKeys.SPILLED_RECORDS, parts[1]);
        } else if (parts[0].equals("Map-Reduce Framework.Reduce shuffle bytes")) {
          job.put(JobKeys.SHUFFLE_BYTES, parts[1]);
        } else {
          System.err.println("JobCounterKey:<"+parts[0]+"> ==> NOT INCLUDED IN PERFORMANCE ADVISOR");
        }
      }
    }  
  }
private void parseAndAddJobCounters ( Hashtable < Enum , String > job , String counters ) throws ParseException { Counters cnt = Counters . fromEscapedCompactString ( counters ) ; for ( java . util . Iterator < Counters . Group > grps = cnt . iterator ( ) ; grps . hasNext ( ) ; ) { Counters . Group grp = grps . next ( ) ; for ( java . util . Iterator < Counters . Counter > mycounters = grp . iterator ( ) ; mycounters . hasNext ( ) ; ) { Counters . Counter counter = mycounters . next ( ) ; String countername = grp . getDisplayName ( ) + "." + counter . getDisplayName ( ) ; String value = ( new Long ( counter . getValue ( ) ) ) . toString ( ) ; String [ ] parts = { countername , value } ; if ( parts [ 0 ] . equals ( "FileSystemCounters.FILE_BYTES_READ" ) ) { job . put ( JobKeys . FILE_BYTES_READ , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "FileSystemCounters.FILE_BYTES_WRITTEN" ) ) { job . put ( JobKeys . FILE_BYTES_WRITTEN , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "FileSystemCounters.HDFS_BYTES_READ" ) ) { job . put ( JobKeys . HDFS_BYTES_READ , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "FileSystemCounters.HDFS_BYTES_WRITTEN" ) ) { job . put ( JobKeys . HDFS_BYTES_WRITTEN , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Job Counters .Launched map tasks" ) ) { job . put ( JobKeys . LAUNCHED_MAPS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Job Counters .Launched reduce tasks" ) ) { job . put ( JobKeys . LAUNCHED_REDUCES , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Job Counters .Data-local map tasks" ) ) { job . put ( JobKeys . DATALOCAL_MAPS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Job Counters .Rack-local map tasks" ) ) { job . put ( JobKeys . RACKLOCAL_MAPS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Map input records" ) ) { job . put ( JobKeys . MAP_INPUT_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Map output records" ) ) { job . put ( JobKeys . MAP_OUTPUT_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Map input bytes" ) ) { job . put ( JobKeys . MAP_INPUT_BYTES , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Map output bytes" ) ) { job . put ( JobKeys . MAP_OUTPUT_BYTES , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Combine input records" ) ) { job . put ( JobKeys . COMBINE_INPUT_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Combine output records" ) ) { job . put ( JobKeys . COMBINE_OUTPUT_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Reduce input groups" ) ) { job . put ( JobKeys . REDUCE_INPUT_GROUPS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Reduce input records" ) ) { job . put ( JobKeys . REDUCE_INPUT_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Reduce output records" ) ) { job . put ( JobKeys . REDUCE_OUTPUT_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Spilled Records" ) ) { job . put ( JobKeys . SPILLED_RECORDS , parts [ 1 ] ) ; } else if ( parts [ 0 ] . equals ( "Map-Reduce Framework.Reduce shuffle bytes" ) ) { job . put ( JobKeys . SHUFFLE_BYTES , parts [ 1 ] ) ; } else { System . err . println ( "JobCounterKey:<" + parts [ 0 ] + "> ==> NOT INCLUDED IN PERFORMANCE ADVISOR" ) ; } } } }
/*
Parse and add the job counters