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


Java StopWatch.start方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.time.StopWatch.start方法的典型用法代码示例。如果您正苦于以下问题:Java StopWatch.start方法的具体用法?Java StopWatch.start怎么用?Java StopWatch.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.time.StopWatch的用法示例。


在下文中一共展示了StopWatch.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteInstance

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
/**
 * Requests deletion of the instance, without creating a final snapshot or deleting any other related
 * snapshots.
 * <p/>
 * Caller must wait for status=deleted or DBInstanceNotFoundException afterwards.
 */
public DBInstance deleteInstance(String instanceName)
{
  LOGGER.debug("deleteDBInstance(instanceName: " + instanceName + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    DeleteDBInstanceRequest request = new DeleteDBInstanceRequest(instanceName);
    request.setSkipFinalSnapshot(true);
    return awsRdsClient.deleteDBInstance(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("deleteDBInstance time elapsed: " + stopWatch);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:24,代码来源:RdsClient.java

示例2: start

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
public void start() throws Exception {

		StopWatch stopWatch = new StopWatch();
		stopWatch.start();

		//游戏基础框架服务启动
		frameworkInit();
		//游戏业务初始化
		gameLogicInit();

		stopWatch.stop();
		logger.error("游戏服务启动,耗时[{}]毫秒", stopWatch.getTime());

		//mbean监控
		MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
		GameMonitorMXBean controller = new GameMonitor();
		mbs.registerMBean(controller, new ObjectName("GameMXBean:name=GameMonitor"));

	}
 
开发者ID:kingston-csj,项目名称:jforgame,代码行数:20,代码来源:GameServer.java

示例3: findAllLinksInLinkMappingWithParent

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
public ObservableList<Link> findAllLinksInLinkMappingWithParent(final long parentId, final LinkMappingType parentType) {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    
    final ObservableList<LinkMapping> allLinkMappingsWithParent = LinkMappingSqlService.getDefault().findAllLinksInLinkMappingWithParent(parentId, parentType);
    final ObservableList<Link> links = FXCollections.observableArrayList();
    allLinkMappingsWithParent.stream()
            .forEach(linkMapping -> {
                final Optional<Link> optional = this.findById(Link.class, linkMapping.getChildId());
                if (optional.isPresent()) {
                    links.add(optional.get());
                }
            });
    
    stopWatch.split();
    this.printToLog(stopWatch.toSplitString(), allLinkMappingsWithParent.size(), "findAllLinksInLinkMappingWithPrimary(long, LinkMappingType)"); // NOI18N
    stopWatch.stop();
    
    return links;
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:21,代码来源:SqlProvider.java

示例4: rebootInstance

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
/**
 * Requests a reboot of the instance.
 * <p/>
 * Caller must wait for status=available afterwards.
 */
public DBInstance rebootInstance(String instanceId)
{
  LOGGER.debug("rebootDBInstance(instanceName: " + instanceId + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    RebootDBInstanceRequest request = new RebootDBInstanceRequest(instanceId);
    return awsRdsClient.rebootDBInstance(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("rebootDBInstance time elapsed: " + stopWatch);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:22,代码来源:RdsClient.java

示例5: deleteParameterGroup

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
/**
 * Deletes the parameter group.  (Assuming it is not in use by any database instance.)
 */
public void deleteParameterGroup(String paramGroupName)
{
  LOGGER.debug("deleteDBParameterGroup(paramGroupName: " + paramGroupName + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    DeleteDBParameterGroupRequest request = new DeleteDBParameterGroupRequest(paramGroupName);
    awsRdsClient.deleteDBParameterGroup(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("deleteDBParameterGroup time elapsed: " + stopWatch);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:20,代码来源:RdsClient.java

示例6: createSnapshot

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
/**
 * Creates an RDS instance snapshot using the specified snapshot id.
 * <p/>
 * Caller must wait for status=available afterwards.
 */
public DBSnapshot createSnapshot(String snapshotId, String instanceName)
{
  LOGGER.debug("createDBSnapshot(snapshotId: " + snapshotId + ", instanceName: " + instanceName + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    CreateDBSnapshotRequest request = new CreateDBSnapshotRequest(snapshotId, instanceName);
    return awsRdsClient.createDBSnapshot(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("createDBSnapshot time elapsed: " + stopWatch);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:22,代码来源:RdsClient.java

示例7: timed

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
/**
 * Executes the specified runnable in a timed block, and prints the measured
 * time to the specified logger, with the specified prefix.
 * 
 * @param log
 *            the logger to print the result to
 * @param prefix
 *            the prefix in the printed message
 * @param f
 *            the runnable to time
 */
public static void timed( Logger log, String prefix, Runnable f )
{
	StopWatch sw = new StopWatch();

	sw.start();
	f.run();
	sw.stop();

	log.trace(
		String.format(
			"%s: %sms (%sns)",
			prefix, sw.getTime(), sw.getNanoTime()
		)
	);
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:27,代码来源:Utils.java

示例8: monitorElapsedTime

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
/**
 * Monitor the elapsed time of method on controller layer, in
 * order to detect performance problems as soon as possible.
 * If elapsed time > 1 s, log it as an error. Otherwise, log it
 * as an info.
 */
@Around("controllerLayer()")
public Object monitorElapsedTime(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
    // Timing the method in controller layer
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    Object result = proceedingJoinPoint.proceed();
    stopWatch.stop();

    // Log the elapsed time
    double elapsedTime = stopWatch.getTime() / 1000.0;
    Signature signature = proceedingJoinPoint.getSignature();
    String infoString = "[" + signature.toShortString() + "][Elapsed time: " + elapsedTime + " s]";
    if (elapsedTime > 1) {
        log.error(infoString + "[Note that it's time consuming!]");
    } else {
        log.info(infoString);
    }

    // Return the result
    return result;
}
 
开发者ID:ShawnyXiao,项目名称:SpringBoot-MyBatis,代码行数:28,代码来源:PerformanceMonitor.java

示例9: testSign

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testSign() {
    StopWatch watch = new StopWatch();
    watch.start();
    String sig = EncryptUtils.signByHmacSHA1(TEST_PLAIN_TEXT, TEST_PASSWORD);
    watch.stop();
    System.out.printf("%d\tms: HmacSHA1 (%s)\n", watch.getTime(), sig);
    assertTrue(EncryptUtils.verifyByHmacSHA1(TEST_PLAIN_TEXT, TEST_PASSWORD, sig));

    watch.reset();
    watch.start();
    sig = EncryptUtils.sha1Hex(TEST_PLAIN_TEXT, TEST_PASSWORD, TEST_PASSWORD);
    watch.stop();
    System.out.printf("%d\tms: SHA1 (%s)\n", watch.getTime(), sig);
    assertTrue(EncryptUtils.verifyBySHA1(TEST_PLAIN_TEXT, TEST_PASSWORD, TEST_PASSWORD, sig));

    watch.reset();
    watch.start();
    sig = EncryptUtils.md5Hex(TEST_PLAIN_TEXT, TEST_PASSWORD);
    watch.stop();
    System.out.printf("%d\tms: MD5 (%s)\n", watch.getTime(), sig);
    assertTrue(EncryptUtils.verifyByMD5(TEST_PLAIN_TEXT, TEST_PASSWORD, sig));
}
 
开发者ID:akuma,项目名称:meazza,代码行数:24,代码来源:EncryptUtilsTest.java

示例10: applyProducers

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
private void applyProducers(List<Mutant<A>> mutants) {
    for (MutantProducer<A> producer : producers) {
        // Time the application of each producer
        StopWatch timer = new StopWatch();
        timer.start();
        List<Mutant<A>> producerMutants = producer.mutate();
        timer.stop();
        producerTimings.put(producer.getClass(), timer);
        
        // Record how many mutants were added by the operator
        int newMutants = producerMutants.size();
        Class producerClass = producer.getClass();
        // Following 2 lines are for compatibility with higher-order mutation
        int producerCount = producerCounts.containsKey(producerClass) ? producerCounts.get(producerClass) : 0;
        producerCounts.put(producerClass, producerCount + newMutants);

        // Store the name of the operator as the simple description
        String simpleDescription = producer.getClass().getSimpleName();
        for (Mutant<A> mutant : producerMutants) {
            mutant.setSimpleDescription(simpleDescription);
        }
        mutants.addAll(producerMutants);
    }
}
 
开发者ID:schemaanalyst,项目名称:schemaanalyst,代码行数:25,代码来源:MutationPipeline.java

示例11: testBlockerExceeding

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testBlockerExceeding() {
    Blocker blocker = new Blocker(TIMEOUT, BLOCK_TIME, MESSAGE);

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    int callCounter = 0;
    while (true) {
        try {
            blocker.block();
            callCounter++;
        } catch (ResourceException e) {
            stopWatch.stop();
            break;
        }
    }

    assertEquals(TIMEOUT / BLOCK_TIME, callCounter, 0.1);
    assertEquals(TIMEOUT, stopWatch.getTime() / 1000, 0.1);
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:22,代码来源:BlockerTest.java

示例12: testRetrieveCustomRecordCustomFields

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testRetrieveCustomRecordCustomFields() throws Exception {
    NetSuiteClientService<?> connection = webServiceTestFixture.getClientService();
    connection.login();

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    RecordTypeInfo recordType = connection.getMetaDataSource()
            .getRecordType("customrecord_campaign_revenue");

    TypeDesc typeDesc = connection.getMetaDataSource().getTypeInfo(recordType.getName());
    logger.debug("Record type desc: {}", typeDesc.getTypeName());

    stopWatch.stop();
}
 
开发者ID:Talend,项目名称:components,代码行数:17,代码来源:NetSuiteClientServiceIT.java

示例13: happy

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
@Test
@Ignore("Not to be used in normal unit tests.  Here for real executions.")
public void happy() throws IOException, InterruptedException {
	BiPredicate<URL, Integer>
		shouldVisit = (url, depth) -> url.getHost().equals("news.yahoo.com");
		shouldVisit = shouldVisit.and( (url, depth) -> depth < 5);
		shouldVisit = shouldVisit.and( (url, depth) -> url.getPath().contains("obama"));

	GrabManager grabManager = new GrabManager(15, shouldVisit);
	StopWatch stopWatch = new StopWatch();

	stopWatch.start();

	grabManager.go(new URL("http://news.yahoo.com"));

	stopWatch.stop();

	System.out.println("Found " + grabManager.getMasterList().size() + " urls");
	System.out.println("in " + stopWatch.getTime() / 1000 + " seconds");

}
 
开发者ID:ssando,项目名称:crawl4neo,代码行数:22,代码来源:GrabManagerTest.java

示例14: get

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
@Override
public ObjectKeys get() {

    LOG.info("Collect object keys");

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    try (BufferedReader reader = new BufferedReader(new FileReader(new File(fileName)))) {
        reader.lines().forEach(objectKeys::add);
    } catch (IOException e) {
        LOG.error("Could not read key file", e);
    }

    stopWatch.stop();

    LOG.info("Time = {} ms", stopWatch.getTime());
    LOG.info("Object keys: {}", objectKeys.size());

    return objectKeys;
}
 
开发者ID:jenshadlich,项目名称:S3-Performance-Test,代码行数:22,代码来源:FileObjectKeysDataProvider.java

示例15: run

import org.apache.commons.lang3.time.StopWatch; //导入方法依赖的package包/类
private void run( final AnalysisLaunchArguments launchArgs ) throws ServiceException {

		final EquityConfiguration equity = equity(launchArgs);
		final BacktestBootstrapConfiguration backtestConfiguration = configuration(equity, launchArgs.openingFunds());
		recordStrategy(backtestConfiguration.strategy());
		recordAnalysisPeriod(backtestConfiguration.backtestDates());

		final StopWatch timer = new StopWatch();
		timer.start();

		try {
			new Backtest(dataService, dataServiceUpdater).run(equity, backtestConfiguration.backtestDates(),
			        context(backtestConfiguration, output()), output());

		} finally {
			HibernateUtil.sessionFactory().close();
		}

		timer.stop();
		recordExecutionTime(timer);
	}
 
开发者ID:CjHare,项目名称:systematic-trading,代码行数:22,代码来源:EntryOrderAnalysis.java


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