/** @throws InterruptedException */
  public static void thru_test() throws InterruptedException {

    String operation = (isRead ? "read" : "write");
    String signed = (withSignature ? "signed" : "unsigned");

    int numReads =
        Math.min(
            Config.getGlobalBoolean(GNSCC.ENABLE_SECRET_KEY) ? Integer.MAX_VALUE : 10000,
            Config.getGlobalInt(TC.NUM_REQUESTS));
    long t = System.currentTimeMillis();
    for (int i = 0; i < numReads; i++) {
      if (isRead) {
        blockingRead(i % numClients, entry, withSignature);
      } else {
        blockingWrite(i % numClients, entry, withSignature);
      }
    }
    System.out.print("[total_" + signed + "_" + operation + "=" + numReads + ": ");
    int lastCount = 0;
    while (numFinishedReads < numReads) {
      if (numFinishedReads > lastCount) {
        lastCount = numFinishedReads;
        System.out.print(
            numFinishedReads
                + "@"
                + Util.df(numFinishedReads * 1.0 / (lastReadFinishedTime - t))
                + "K/s ");
      }
      Thread.sleep(1000);
    }
    System.out.println("] ");

    System.out.println(
        "parallel_"
            + signed
            + "_"
            + operation
            + "_rate="
            + Util.df(numReads * 1.0 / (lastReadFinishedTime - t))
            + "K/s");
  }
 private static void processArgs(String[] args) throws IOException {
   Config.register(args);
 }
  /** @throws InterruptedException */
  public static void sequential_thru_test() throws InterruptedException {
    String signed = withSignature ? "signed" : "unsigned";
    String operation = isRead ? "read" : "write";

    assert (malEntry != null) : "Malicious guid can not be null";
    assert (ratio > 0.0) : "ration can't be 0 or negative";
    int numReads = Config.getGlobalInt(TC.NUM_REQUESTS);
    int malReads =
        ((Number) (numReads * fraction / (fraction + ratio * (1 - fraction)))).intValue();

    System.out.println(
        "Start running experiment with "
            + numReads
            + " benign requests and "
            + malReads
            + " malicious requests, "
            + "the ratio is "
            + ratio
            + " with the malicious fraction="
            + fraction);
    long t = System.currentTimeMillis();

    new Thread() {
      public void run() {
        for (int i = 0; i < numReads - malReads; i++) {
          blockingRead(i % numClients, entry, withSignature);
        }
      }
    }.start();
    new Thread() {
      public void run() {
        for (int i = 0; i < malReads; i++) {
          blockingRead(i % numClients, malEntry, withSignature);
        }
      }
    }.start();

    System.out.print("[total_" + signed + "_" + operation + "=" + numReads + ": ");
    int lastCount = 0;
    while (numFinishedReads < numReads) {
      if (numFinishedReads > lastCount) {
        lastCount = numFinishedReads;
        System.out.print(
            numFinishedReads
                + "@"
                + Util.df(numFinishedReads * 1.0 / (lastReadFinishedTime - t))
                + "K/s ");
      }
      Thread.sleep(1000);
    }
    System.out.println("] ");

    System.out.println(
        "parallel_"
            + signed
            + "_"
            + operation
            + "_rate="
            + Util.df(numReads * 1000.0 / (lastReadFinishedTime - t))
            + "/s");
  }