當前位置: 首頁>>代碼示例>>Java>>正文


Java StopWatch.stop方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.time.StopWatch.stop方法的典型用法代碼示例。如果您正苦於以下問題:Java StopWatch.stop方法的具體用法?Java StopWatch.stop怎麽用?Java StopWatch.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.time.StopWatch的用法示例。


在下文中一共展示了StopWatch.stop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: deleteAllExerciseTermsWithExerciseId

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
void deleteAllExerciseTermsWithExerciseId(long exerciseId) {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    
    final ObservableList<ExerciseTerm> exerciseTerms = SqlProvider.getDefault().findAllExerciseTermsWithExerciseId(exerciseId);
    
    DatabaseFacade.getDefault().getCrudService().beginTransaction();
    exerciseTerms.stream()
            .forEach(exerciseTerm -> {
                DatabaseFacade.getDefault().getCrudService().getEntityManager().remove(exerciseTerm);
            });
    DatabaseFacade.getDefault().getCrudService().commitTransaction();
    
    stopWatch.split();
    LoggerFacade.getDefault().debug(this.getClass(), "  + Need " + stopWatch.toSplitString() + " for executing [deleteAllExerciseTermsWithExerciseId(long)]"); // NOI18N
    this.printToLog(stopWatch.toSplitString(), exerciseTerms.size(), "deleteAllExerciseTermsWithExerciseId(long exerciseId)"); // NOI18N
    stopWatch.stop();
}
 
開發者ID:Naoghuman,項目名稱:ABC-List,代碼行數:19,代碼來源:ExerciseTermSqlService.java

示例4: 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

示例5: registerInstance

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Requests registration of the ec2 instance with the ELB.
 * <p/>
 * After calling here, you need to call DescribeLoadBalancers or DescribeInstanceHealth to see if registration is
 * complete.
 */
public void registerInstance(String elbName, String ec2InstanceId)
{
  LOGGER.debug("registerInstancesWithLoadBalancer(elbName: " + elbName + ", ec2InstanceId: " + ec2InstanceId + ")");
  assertNonBlankArgs(elbName, ec2InstanceId);
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    RegisterInstancesWithLoadBalancerRequest request = new RegisterInstancesWithLoadBalancerRequest();
    request.setLoadBalancerName(elbName);
    request.setInstances(Arrays.asList(new Instance(ec2InstanceId)));
    awsElbClient.registerInstancesWithLoadBalancer(request);
    //Currently not doing anything with the RegisterInstancesWithLoadBalancerResult
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("registerInstancesWithLoadBalancer time elapsed " + stopWatch);
  }
}
 
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:27,代碼來源:ElbClient.java

示例6: deleteSnapshot

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Deletes the snapshot.  (Assuming it was in available state.)
 * <p/>
 * Caller must wait for status=deleted afterwards.
 */
public DBSnapshot deleteSnapshot(String snapshotId)
{
  LOGGER.debug("deleteDBSnapshot(snapshotId: " + snapshotId + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    DeleteDBSnapshotRequest request = new DeleteDBSnapshotRequest(snapshotId);
    return awsRdsClient.deleteDBSnapshot(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("deleteDBSnapshot time elapsed: " + stopWatch);
  }
}
 
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:22,代碼來源:RdsClient.java

示例7: modifyInstanceWithSecgrpParamgrp

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Modifies the instance by applying new security groups and new parameter group.
 * <p/>
 * Caller must wait for status=available afterwards.
 */
public DBInstance modifyInstanceWithSecgrpParamgrp(String instanceName,
                                                   Collection<String> vpcSecurityGroupIds,
                                                   String paramGroupName)
{
  LOGGER.debug("modifyDBInstance(instanceName: " + instanceName + ", vpcSecurityGroupIds: ("
      + StringUtils.join(vpcSecurityGroupIds, ", ") + "), paramGroupName: " + paramGroupName + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    ModifyDBInstanceRequest request = new ModifyDBInstanceRequest(instanceName);
    request.setVpcSecurityGroupIds(vpcSecurityGroupIds);
    request.setDBParameterGroupName(paramGroupName);
    return awsRdsClient.modifyDBInstance(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("modifyDBInstance time elapsed: " + stopWatch);
  }
}
 
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:27,代碼來源:RdsClient.java

示例8: 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

示例9: getResponseFromPrimedContext

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
@Test                 //  primed,   got
//                        30_000, 1,000
// naive,loop                100,    10
// map, linear insert        100,     6
// map, get on insert        0.1, 0.005
public void getResponseFromPrimedContext() {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    primings.forEach(primingContext::add);
    stopWatch.stop();
    long time = stopWatch.getTime();
    System.out.println(time + " ms elapsed inserting " + primings.size() + " primings");

    stopWatch.reset();
    stopWatch.start();
    for (int i : indices) {
        final AppRequest request = primings.get(i).getAppRequest();
        primingContext.getResponse(request).get();
    }
    time = stopWatch.getTime();
    System.out.println(time + " ms elapsed getting " + indices.size() + " requests");
}
 
開發者ID:jonnymatts,項目名稱:JZONbie,代碼行數:23,代碼來源:PrimingContextPerformanceTest.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: actionGetDocument

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
private String actionGetDocument(JCas jCas)
{
    StopWatch timer = new StopWatch();
    timer.start();
    
    GetDocumentResponse response = new GetDocumentResponse();
    String json;
    if (getModelObject().getProject() != null) {
        render(response, jCas);
        json = toJson(response);
        lastRenderedJson = json;
    }
    else {
        json = toJson(response);
    }
    
    timer.stop();
    metrics.renderComplete(RenderType.FULL, timer.getTime(), json, null);
    
    return json;
}
 
開發者ID:webanno,項目名稱:webanno,代碼行數:22,代碼來源:BratAnnotationEditor.java


注:本文中的org.apache.commons.lang3.time.StopWatch.stop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。