code: public ResourceUsage getResourceUsage() {
      int totalMapperGrants = 0;
      int totalReducerGrants = 0;
      synchronized (lockObject) {
        for (Map.Entry<Integer, ResourceGrant> entry :
            grantedResources.entrySet()) {
          switch(entry.getValue().getType()) {
          case MAP:
            ++totalMapperGrants;
            break;
          case REDUCE:
            ++totalReducerGrants;
            break;
          case JOBTRACKER:
            // Ignore for now
            break;
          default:
            throw new RuntimeException("Illegal type " +
                                       entry.getValue().getType());
          }
        }
      }
      return new ResourceUsage(totalMapperGrants, totalReducerGrants);
    }
docs: Get a snapshot of the resource usage.
  
  @return Snapshot of resource usage