本文整理汇总了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);
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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()
)
);
}
示例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");
}
示例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));
}
示例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);
}
}
示例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);
}
示例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();
}
示例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");
}
示例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;
}