本文整理了Java中org.apache.commons.lang3.time.StopWatch.stop()
方法的一些代码示例,展示了StopWatch.stop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StopWatch.stop()
方法的具体详情如下:
包路径:org.apache.commons.lang3.time.StopWatch
类名称:StopWatch
方法名:stop
[英]Stop the stopwatch.
This method ends a new timing session, allowing the time to be retrieved.
[中]停下秒表。
此方法结束一个新的计时会话,允许检索时间。
代码示例来源:origin: apache/usergrid
@Override
public void onCompleted() {
timer.stop();
latch.countDown();
}
代码示例来源:origin: apache/usergrid
@Override
public void onCompleted() {
timer.stop();
latch.countDown();
}
代码示例来源:origin: apache/hbase
@Override public Void call() throws Exception {
ZooKeeper zooKeeper = null;
try {
zooKeeper = new ZooKeeper(host, timeout, EmptyWatcher.instance);
Stat exists = zooKeeper.exists(znode, false);
StopWatch stopwatch = new StopWatch();
stopwatch.start();
zooKeeper.getData(znode, false, exists);
stopwatch.stop();
sink.publishReadTiming(znode, host, stopwatch.getTime());
} catch (KeeperException | InterruptedException e) {
sink.publishReadFailure(znode, host);
} finally {
if (zooKeeper != null) {
zooKeeper.close();
}
}
return null;
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testLang315() {
final StopWatch watch = new StopWatch();
watch.start();
try {
Thread.sleep(200);
} catch (final InterruptedException ex) {
}
watch.suspend();
final long suspendTime = watch.getTime();
try {
Thread.sleep(200);
} catch (final InterruptedException ex) {
}
watch.stop();
final long totalTime = watch.getTime();
assertTrue(suspendTime == totalTime);
}
代码示例来源:origin: apache/hbase
private static void timerTests(final CellBlockBuilder builder, final int count, final int size,
final Codec codec, final CompressionCodec compressor) throws IOException {
final int cycles = 1000;
StopWatch timer = new StopWatch();
timer.start();
for (int i = 0; i < cycles; i++) {
timerTest(builder, timer, count, size, codec, compressor, false);
}
timer.stop();
LOG.info("Codec=" + codec + ", compression=" + compressor + ", sized=" + false + ", count="
+ count + ", size=" + size + ", + took=" + timer.getTime() + "ms");
timer.reset();
timer.start();
for (int i = 0; i < cycles; i++) {
timerTest(builder, timer, count, size, codec, compressor, true);
}
timer.stop();
LOG.info("Codec=" + codec + ", compression=" + compressor + ", sized=" + true + ", count="
+ count + ", size=" + size + ", + took=" + timer.getTime() + "ms");
}
代码示例来源:origin: apache/hbase
stopWatch.start();
table.get(get);
stopWatch.stop();
} else {
scan = new Scan();
s.next();
s.close();
stopWatch.stop();
代码示例来源:origin: apache/usergrid
private CandidateResults testQuery( final SearchEdge scope, final SearchTypes searchTypes,
final String queryString,
final int num ) {
StopWatch timer = new StopWatch();
timer.start();
CandidateResults candidateResults = entityIndex.search( scope, searchTypes, queryString, 1000, 0, false );
timer.stop();
assertEquals(num, candidateResults.size());
logger.debug("Query time {}ms", timer.getTime());
return candidateResults;
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testStopWatchSuspend() {
final StopWatch watch = new StopWatch();
watch.start();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.suspend();
final long suspendTime = watch.getTime();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.resume();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.stop();
final long totalTime = watch.getTime();
assertTrue(suspendTime >= 500);
assertTrue(suspendTime < 700);
assertTrue(totalTime >= 1000);
assertTrue(totalTime < 1300);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testStopWatchSplit() {
final StopWatch watch = new StopWatch();
watch.start();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.split();
final long splitTime = watch.getSplitTime();
final String splitStr = watch.toSplitString();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.unsplit();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.stop();
final long totalTime = watch.getTime();
assertEquals("Formatted split string not the correct length",
splitStr.length(), 12);
assertTrue(splitTime >= 500);
assertTrue(splitTime < 700);
assertTrue(totalTime >= 1500);
assertTrue(totalTime < 1900);
}
代码示例来源:origin: apache/usergrid
timer.stop();
logger.info( "Total time to write {} entries {}ms", limit, timer.getTime() );
timer.reset();
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testStopWatchSimple() {
final StopWatch watch = new StopWatch();
watch.start();
try {
Thread.sleep(550);
} catch (final InterruptedException ex) {
}
watch.stop();
final long time = watch.getTime();
assertEquals(time, watch.getTime());
assertTrue(time >= 500);
assertTrue(time < 700);
watch.reset();
assertEquals(0, watch.getTime());
}
代码示例来源:origin: apache/usergrid
timer.stop();
logger.info( "Total time to write {} entries {} ms", writeLimit, timer.getTime() );
timer.reset();
代码示例来源:origin: apache/usergrid
private void insertJsonBlob( List<Object> sampleJson, EntityIndexBatch batch, String entityType,
IndexEdge indexEdge, final int max, final int startIndex ) throws IOException {
int count = 0;
StopWatch timer = new StopWatch();
timer.start();
if ( startIndex > 0 ) {
for ( int i = 0; i < startIndex; i++ ) {
sampleJson.remove( 0 );
}
}
for ( Object o : sampleJson ) {
Map<String, Object> item = ( Map<String, Object> ) o;
Entity entity = new Entity( entityType );
entity = EntityIndexMapUtils.fromMap( entity, item );
EntityUtils.setVersion( entity, UUIDGenerator.newTimeUUID() );
entity.setField( new UUIDField( IndexingUtils.ENTITY_ID_FIELDNAME, UUID.randomUUID() ) );
batch.index( indexEdge, entity );
if ( ++count > max ) {
break;
}
}
timer.stop();
logger.info( "Total time to index {} entries {}ms, average {}ms/entry",
new Object[] { count, timer.getTime(), timer.getTime() / count } );
}
代码示例来源:origin: apache/hbase
rs.next();
stopWatch.stop();
this.readWriteLatency.add(stopWatch.getTime());
sink.publishReadTiming(serverName, region, column, stopWatch.getTime());
代码示例来源:origin: apache/usergrid
entityIndex.search( indexEdge, searchTypes, "select * where uuid = '"+uuid+"'", 100, 0, false );
timer.stop();
代码示例来源:origin: apache/usergrid
timer.stop();
logger.info( "Total time to write {} entries {}ms", limit, timer.getTime());
timer.reset();
assertNotNull("Returned has a version", entity.getVersion());
timer.stop();
logger.info( "Total time to read {} entries {}ms", limit, timer.getTime());
代码示例来源:origin: org.apache.commons/commons-lang3
final StopWatch watch = new StopWatch();
try {
watch.stop();
fail("Calling stop on an unstarted StopWatch should throw an exception. ");
} catch (final IllegalStateException ise) {
watch.stop();
fail("Calling stop on an unstarted StopWatch should throw an exception. ");
} catch (final IllegalStateException ise) {
watch.stop();
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testBooleanStates() {
final StopWatch watch = new StopWatch();
assertFalse(watch.isStarted());
assertFalse(watch.isSuspended());
assertTrue(watch.isStopped());
watch.start();
assertTrue(watch.isStarted());
assertFalse(watch.isSuspended());
assertFalse(watch.isStopped());
watch.suspend();
assertTrue(watch.isStarted());
assertTrue(watch.isSuspended());
assertFalse(watch.isStopped());
watch.stop();
assertFalse(watch.isStarted());
assertFalse(watch.isSuspended());
assertTrue(watch.isStopped());
}
代码示例来源:origin: apache/usergrid
entityIndex.search( indexEdge, searchTypes, "select * where testfield = 'test' order by ordinal", 100, 0, false );
timer.stop();
代码示例来源:origin: winder/Universal-G-Code-Sender
protected void fileStreamComplete(String filename, boolean success) {
String duration =
com.willwinder.universalgcodesender.Utils.
formattedMillis(this.getSendDuration());
this.dispatchConsoleMessage(MessageType.INFO,"\n**** Finished sending file in "+duration+" ****\n\n");
this.streamStopWatch.stop();
this.isStreaming = false;
dispatchStreamComplete(filename, success);
}
内容来源于网络,如有侵权,请联系作者删除!