public void measurement(boolean count, boolean time, int c) {
    Measurement m = new Measurement();
    m.start();
    Measurement t = new Measurement(time, count);

    for (int i = 0; i < c; i++) {
      t.start();
      t.stop();
    }
    m.stop();
    System.out.println(
        time
            + "/"
            + count
            + " "
            + c
            + " measurements took: "
            + Long.toString(m.getElapsedTime() / 1000)
            + " us, on average "
            + Double.toString(m.getElapsedTime() / c)
            + " ns");
  }
  public void _testBlock() {
    Measurement m = new Measurement();
    final Object o = new Object();
    final Thread current = Thread.currentThread();
    Thread x =
        new Thread() {
          @Override
          public void run() {
            System.out.println("started");
            synchronized (o) {
              System.out.println("in synchronized block");
              System.out.println("state of starting thread " + current.getState());
              System.out.println("notifyAll");
              o.notifyAll();
            }
          }
        };
    m.start();

    synchronized (o) {
      System.out.println("starting");
      x.start();

      try {
        System.out.println("state of notifying thread " + x.getState());
        System.out.println("waiting");
        o.wait();
        System.out.println("done waiting");
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    m.stop();

    try {
      x.join();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    Assert.assertEquals(0, m.getBlockCountDelta());
    Assert.assertEquals(1, m.getWaitCountDelta());
  }
  public void testMeasure() throws InterruptedException {

    Measurement m = new Measurement();
    m.start();
    Object o = new Object();
    synchronized (o) {
      o.wait(500);
    }
    long j = 0;
    for (int i = 0; i < 6000000; i++) {
      j = j + (j * i);
    }
    m.stop();
    long t = m.getElapsedTime();
    System.out.println("elapsed: " + t);
    long c = m.getElapsedCpuTime();
    System.out.println(c);
    long u = m.getElapsedUserTime();
    System.out.println(u);
    long b = m.getBlockCountDelta();
    System.out.println(b);
    long w = m.getWaitCountDelta();
    System.out.println(w);
  }