本文整理汇总了Java中org.apache.commons.lang.time.StopWatch.reset方法的典型用法代码示例。如果您正苦于以下问题:Java StopWatch.reset方法的具体用法?Java StopWatch.reset怎么用?Java StopWatch.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.time.StopWatch
的用法示例。
在下文中一共展示了StopWatch.reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFP
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
public void testFP() throws IOException {
Generic<String> q = new Generic<String>();
for (int x = 0; x < STAYS_COUNT; ++x) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
for (int i = 0; i < TIMES; ++i) {
jsonSerialize(q);
}
stopWatch.stop();
System.out.println("JSON serialize:" + stopWatch.getTime());
stopWatch.reset();
stopWatch.start();
for (int i = 0; i < TIMES; ++i) {
javaSerialize(q);
}
stopWatch.stop();
System.out.println("JAVA serialize:" + stopWatch.getTime());
System.out.println();
}
}
示例2: testSerializePerformance
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testSerializePerformance() throws IOException {
Object obj = createTest();
for (int x = 0; x < 20; ++x) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
for (int i = 0; i < TIMES; ++i) {
jsonSerialize(obj);
}
stopWatch.stop();
System.out.println("JSON serialize:" + stopWatch.getTime());
stopWatch.reset();
stopWatch.start();
for (int i = 0; i < TIMES; ++i) {
javaSerialize(obj);
}
stopWatch.stop();
System.out.println("JAVA serialize:" + stopWatch.getTime());
System.out.println();
}
}
示例3: timerTests
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
private static void timerTests(final IPCUtil util, 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(util, 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(util, timer, count, size, codec, compressor, true);
}
timer.stop();
LOG.info("Codec=" + codec + ", compression=" + compressor + ", sized=" + true +
", count=" + count + ", size=" + size + ", + took=" + timer.getTime() + "ms");
}
示例4: main
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
public static void main(String args[]) {
CoraBenchmark cora = new CoraBenchmark();
StopWatch watch = new StopWatch();
Map<CoraRecord, Collection<CoraRecord>> potentialStitches;
Collection<CoraRecord> coll =
cora.retrieveRecordsFromFile("C:\\Users\\formosos\\Documents\\Cora\\cora-all-id.xml");
// printCollectionToFile(coll, "C:\\Users\\formosos\\Documents\\Cora\\cora-all-id.txt");
cora.generateIndexes(coll);
// cora.printIndex(cora.authorWordIndex, "Author word index");
cora.printIndex(cora.titleWordIndex, "Title word index");
cora.printIndex(cora.publicationWordIndex, "Publication word index");
watch.start();
potentialStitches =
cora.generatePotentialStitches(Arrays.asList(cora.itemsById.get("20"), cora.itemsById.get("43")));
watch.stop();
cora.printPotentialStitches(potentialStitches);
System.out.printf("Number of calculated potential stitches: %d\n",
cora.countPotentialStitches(potentialStitches));
System.out.printf("Exec time: %s\n", watch.toString());
System.out.println();
watch.reset();
watch.start();
potentialStitches = cora.generatePotentialStitches(coll);
watch.stop();
System.out.printf("Number of calculated potential stitches: %d\n",
cora.countPotentialStitches(potentialStitches));
System.out.printf("Exec time: %s\n", watch.toString());
System.out.println();
System.out.println("End of program.");
}