コード例 #1
0
ファイル: BySplit.java プロジェクト: ebikyatto/JavaExample
  public static void main(String[] args) {
    Benchmarker.MILLISECONDS.reset();
    Benchmarker.MILLISECONDS.start();

    for (int counter = 0; counter < Benchmarker.LOOP_TIME; counter++) {
      String[] elements = Benchmarker.TEST_STRING.split(",");
      for (String element : elements) ;
    }

    Benchmarker.MILLISECONDS.stop();
    Benchmarker.MILLISECONDS.showDuration();
    Benchmarker.showMemoryUsed();
  }
コード例 #2
0
  @Suspendable
  protected void benchmarkMethod() {

    try {
      AsyncAdaptor<String> aa =
          new AsyncAdaptor<String>() {
            @Override
            protected void requestAsync() {
              ai.asyncMethod("foo", this);
            }
          };

      String result = aa.run();

      benchmarker.iterDone(result.hashCode());

      vertx.runOnContext(fiberHandler(v -> benchmarkMethod()));

    } catch (Throwable t) {
      t.printStackTrace();
    }
  }