当前位置: 首页>>代码示例>>Java>>正文


Java StopWatch.reset方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:TestFastJson.java

示例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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:TestFastJson.java

示例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");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:22,代码来源:TestIPCUtil.java

示例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.");
}
 
开发者ID:HewlettPackard,项目名称:loom,代码行数:38,代码来源:CoraBenchmark.java


注:本文中的org.apache.commons.lang.time.StopWatch.reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。