コード例 #1
0
ファイル: HTTPDBenchmark.java プロジェクト: victori/voltdb
  public void JSONBench(int clientCount, int iterations) throws Exception {
    ServerThread server = startup();
    Thread.sleep(1000);

    JSONClient[] clients = new JSONClient[clientCount];
    for (int i = 0; i < clientCount; i++) clients[i] = new JSONClient(i, iterations);

    long execTime = 0;

    long start = System.nanoTime();
    for (JSONClient client : clients) {
      client.start();
    }
    for (JSONClient client : clients) {
      client.join();
      execTime += client.totalExecTime;
    }

    long finish = System.nanoTime();

    double seconds = (finish - start) / (1000d * 1000d * 1000d);
    double rate = (iterations * clientCount) / seconds;
    double latency = execTime / (double) (iterations * clientCount);
    latency /= 1000d * 1000d;

    System.out.printf(
        "Simple bench did %.2f iterations / sec at %.2f ms latency per txn.\n", rate, latency);

    server.shutdown();
    server.join();
  }
コード例 #2
0
ファイル: TestCSVLoader.java プロジェクト: cgvarela/voltdb
  @AfterClass
  public static void stopDatabase() throws InterruptedException {
    if (client != null) client.close();
    client = null;

    if (localServer != null) {
      localServer.shutdown();
      localServer.join();
    }
    localServer = null;
  }