/**
   * Get the percentage of jobs in the job group owning the given job which are currently Queued or
   * Preempted.
   */
  public double percentPending(TaskTimer timer, long jobID) {
    Counters counters = null;
    timer.acquire();
    synchronized (pCountersByJob) {
      timer.resume();
      counters = pCountersByJob.get(jobID);
    }

    if (counters != null) {
      double percent = counters.percentPending();

      //       if(LogMgr.getInstance().isLoggable(LogMgr.Kind.Ops, LogMgr.Level.Finest))
      //         LogMgr.getInstance().log
      //           (LogMgr.Kind.Ops, LogMgr.Level.Finest,
      //            "Percent Pending [" + jobID + "]: " + String.format("%1$.4f", percent));

      return percent;
    } else {
      LogMgr.getInstance()
          .logAndFlush(
              LogMgr.Kind.Ops,
              LogMgr.Level.Warning,
              "Somehow the job (" + jobID + ") was not in the state counts table!");
      return 0.0;
    }
  }
  /** Get the percentage of jobs in the job group which are currently Queued or Preempted. */
  public double percentPendingByGroup(TaskTimer timer, long jobGroupID) {
    Counters counters = null;
    timer.acquire();
    synchronized (pCountersByGroup) {
      timer.resume();
      counters = pCountersByGroup.get(jobGroupID);
    }

    if (counters != null) {
      double percent = counters.percentPending();

      return percent;
    } else {
      LogMgr.getInstance()
          .logAndFlush(
              LogMgr.Kind.Ops,
              LogMgr.Level.Warning,
              "Somehow the job group (" + jobGroupID + ") was not in the state counts table!");
      return 0.0;
    }
  }