public void run (){ long stamp = System.nanoTime(); for (int i=0; i<COUNT; i++) { sp1.in(key); tpsIn.tick(); } long stamp2 = System.nanoTime(); t2.add(stamp2-stamp); System.err.println("Read "+key+" in: "+(stamp2-stamp)/1000000 + " " + tpsIn.toString()); } }
public void run (){ long stamp = System.nanoTime(); for (int i=0; i<COUNT; i++) { sp1.out(key, Boolean.TRUE); tpsOut.tick(); } long stamp2 = System.nanoTime(); t1.add(stamp2-stamp); System.err.println("Write "+key+" out: "+(stamp2-stamp)/1000000 + " " + tpsOut.toString()); } }
public void run() { TPS tps = new TPS(); try (BinLogWriter bl = new BinLogWriter(dir)) { for (int i = 1; i <= 10000; i++) { long l = cnt.incrementAndGet(); if (i % 5000 == 0) { bl.cutover(); } bl.add(ISOUtil.zeropad(l, 12).getBytes()); tps.tick(); } tps.dump(System.out, ""); } catch (Throwable e) { e.printStackTrace(System.err); } }
public void test1000TPSManualUpdate() throws Exception { TPS tps = new TPS(); for (int i=0; i<1000; i++) tps.tick(); Thread.sleep (1050L); assertTrue("Expected aprox 1000 TPS but was "+ tps.intValue(), tps.intValue() >= 900); assertTrue("Still expecting aprox 1000 TPS on a second call", tps.intValue() >= 900); Thread.sleep (1050L); assertEquals( "TPS should be zero but it's "+tps.intValue() + " (" + tps.floatValue() + ")", 0, tps.intValue() ); } }
purge (id, false); tps.tick();
public void test1000TPSAutoUpdate() throws Exception { TPS tps = new TPS(true); for (int i=0; i<1000; i++) tps.tick(); Thread.sleep (1050L); // java.util.Timer is not accurate assertEquals("Expected 1000 TPS", 1000, tps.intValue()); assertEquals("Still expecting 1000 TPS on a second call", 1000, tps.intValue()); Thread.sleep (1000L); assertTrue ("Average should be aprox 0.5 but it's " + tps.getAvg(), tps.getAvg() >= 0.5); assertEquals( "TPS should be zero but it's "+tps.intValue() + " (" + tps.floatValue() + ")", 0, tps.intValue() ); assertEquals ("Peak has to be 1000", 1000, tps.getPeak()); tps.stop(); } public void test1000TPSManualUpdate() throws Exception {