本文整理汇总了Java中org.apache.commons.lang.time.StopWatch.stop方法的典型用法代码示例。如果您正苦于以下问题:Java StopWatch.stop方法的具体用法?Java StopWatch.stop怎么用?Java StopWatch.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.time.StopWatch
的用法示例。
在下文中一共展示了StopWatch.stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWrongUUIDRegister
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testWrongUUIDRegister() {
StopWatch watch = new StopWatch();
LOG.info("testing OpMgrRegistration");
watch.start();
List<String> opList = opMgr.listOperations(UUID.randomUUID());
assertTrue(opList.size() == 0);
opMgr.registerOperation("FAKEOP", firstMeta, UUID.randomUUID());
assertEquals(startValues, opMgr.listOperations(OperationManagerImpl.LOOM_UUID).size());
opMgr.registerOperation("", firstMeta, OperationManagerImpl.LOOM_UUID);
assertEquals(startValues, opMgr.listOperations(OperationManagerImpl.LOOM_UUID).size());
opMgr.registerOperation("FAKEOP", null, OperationManagerImpl.LOOM_UUID);
assertEquals(startValues, opMgr.listOperations(OperationManagerImpl.LOOM_UUID).size());
watch.stop();
LOG.info("tested OpMgrRegistration --> " + watch);
}
示例2: 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");
}
示例3: testCreateOneAggregation
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testCreateOneAggregation()
throws NoSuchSessionException, SessionAlreadyExistsException, DuplicateAdapterException,
LogicalIdAlreadyExistsException, NoSuchProviderException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing CreateOneAggregation");
watch.start();
Provider prov = createProvider();
adapterManager.registerAdapter(createUnregisteredDoNothingAdapter(prov));
ItemType type = new FakeType();
type.setId("fake-" + type.getLocalId());
Session session = createSession();
aggregationManager.createSession(session);
adapterManager.createGroundedAggregation(session, prov, type, null, true, "vms",
"List of virtual machines - fake", 44);
assertTrue("aggregationManager should know this aggregation",
aggregationManager.getAggregation(session, "os/testfake/testfakes") != null);
watch.stop();
LOG.info("tested CreateOneAggregation --> " + watch);
}
示例4: testGetItemLogicalId
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testGetItemLogicalId()
throws NoSuchProviderException, DuplicateAdapterException, NoSuchSessionException,
SessionAlreadyExistsException, LogicalIdAlreadyExistsException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing GetItemLogicalId");
watch.start();
Provider prov = createProvider();
ItemType type = new FakeType();
type.setId("fake-" + type.getLocalId());
Session session = createSession();
aggregationManager.createSession(session);
Aggregation agg = adapterManager.createGroundedAggregation(session, prov, type, null, true, "vms",
"List of virtual machines - fake", 44);
adapterManager.registerAdapter(createUnregisteredDoNothingAdapter(prov));
String itemId = "a123";
assertTrue("item LogicalId should combine agg logicalId with itemId ",
LoomUtils.getItemLogicalId(agg, itemId).equals(agg.getLogicalId() + "/" + itemId));
watch.stop();
LOG.info("tested GetItemLogicalId --> " + watch);
}
示例5: testDereisteringAllPatterns
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testDereisteringAllPatterns() throws NoSuchProviderException, DuplicateAdapterException,
DuplicatePatternException, NullPatternIdException, NoSuchPatternException, UnsupportedOperationException,
DuplicateItemTypeException, NullItemTypeIdException {
StopWatch watch = new StopWatch();
LOG.info("testing DereisteringAllPatterns");
watch.start();
Provider prov = createProvider();
DoNothingAdapter dna = createUnregisteredDoNothingAdapter(prov);
adapterManager.registerAdapter(dna);
PatternDefinition pat1 = new PatternDefinition("pat1");
PatternDefinition pat2 = new PatternDefinition("pat2");
HashSet<PatternDefinition> patternSet = new HashSet<PatternDefinition>();
patternSet.add(pat1);
patternSet.add(pat2);
adapterManager.addPatternDefinitions(prov, patternSet);
assertTrue("tapestryManager should have received pat1", tapestryManager.getPatterns(prov).contains(pat1));
assertTrue("tapestryManager should have received pat2", tapestryManager.getPatterns(prov).contains(pat2));
assertTrue("adapterManager should profix Id with providerType",
pat1.getId().startsWith(prov.getProviderType()));
// clean up
adapterManager.removePatternDefinitions(prov);
adapterManager.deregisterAdapter(dna, new HashSet<>(0));
watch.stop();
LOG.info("tested DereisteringAllPatterns --> " + watch);
}
示例6: testProjectJson
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testProjectJson() throws Exception {
StopWatch watch = new StopWatch();
LOG.info("testing ProjectJson");
watch.start();
// create a project Item
ItemType type = new OsProjectType();
type.setId("os-" + type.getLocalId());
OsProject project = new OsProject("/os/fake/projects/p1", type);
OsProjectAttributes opa = new OsProjectAttributes();
opa.setItemName("p1");
opa.setItemId("pId1");
opa.setItemDescription("description");
opa.setProviderId("fake");
project.setCore(opa);
LOG.info("created JSON is\n" + toJson(project));
watch.stop();
LOG.info("tested ProjectJson --> " + watch);
}
示例7: get
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
private <T> T get(final String url, final java.lang.Class<T> tClass, final Object... uriVariables) {
setErrorHandler();
StopWatch watch = new StopWatch();
watch.start();
// T object = restTemplate.getForObject(url, tClass, uriVariables);
ResponseEntity<T> response = restTemplate.getForEntity(url, tClass, uriVariables);
HttpHeaders headers = response.getHeaders();
List<String> cookies = headers.get("Set-Cookie");
if (cookies != null && cookies.size() > 0) {
for (String cookie : cookies) {
if (cookie.substring(0, cookie.indexOf("=")).equals(LoomClient.SESSION_COOKIE)) {
sessionId = cookie.substring(cookie.indexOf("=") + 1, cookie.indexOf(";"));
if (sessionId.equals("")) {
sessionId = null;
}
break;
}
}
}
watch.stop();
if (log.isTraceEnabled()) {
String args = "";
for (Object arg : uriVariables) {
args += " " + arg;
}
if (watch.getTime() > timewarning) {
log.trace("GET " + url + " " + args + " WARNING: Operation took " + watch);
} else {
log.trace("GET " + url + " " + args + " Operation took " + watch);
}
}
return response.getBody();
// return object;
}
示例8: testJustSleep
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testJustSleep() throws InterruptedException {
StopWatch watch = new StopWatch();
LOG.info("testing JustSleep");
watch.start();
Provider prov =
new FakeProviderImpl("os", "private", "http://16.25.166.21:5000/v2.0", "Private", "test", "test");
assertNotNull("adapter not created", fakeAdapter);
LOG.info("prov: " + prov);
LOG.info("faProv: " + fakeAdapter.getProvider());
assertEquals(true, prov.equals(fakeAdapter.getProvider()));
LOG.info("test just sleeping...");
// sleep(1 * 60000);
watch.stop();
LOG.info("tested JustSleep --> " + watch);
}
示例9: testVolumeJson
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testVolumeJson() throws Exception {
StopWatch watch = new StopWatch();
LOG.info("testing VolumeJson");
watch.start();
// create a volume Item
ItemType type = new OsVolumeType(provider);
type.setId("os-" + type.getLocalId());
OsVolume volume = new OsVolume("/os/fake/volumes/v1", type);
OsVolumeAttributes ova =
new OsVolumeAttributes("v1", "vId1", 40, "AVAILABLE", "zone", new Date().toString(), "None", "1234");
ova.setItemDescription("A description");
volume.setCore(ova);
LOG.info("created JSON is\n" + toJson(volume));
watch.stop();
LOG.info("tested VolumeJson --> " + watch);
}
示例10: testAdapterDeregistration
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testAdapterDeregistration()
throws NoSuchProviderException, DuplicateAdapterException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing AdapterDeregistration");
watch.start();
Provider testProvider = new FakeProviderImpl("test", "test", "test", "test", "test", "com");
DoNothingAdapter dna = new DoNothingAdapter(testProvider);
dna.setAdapterManager(adapterManager, null);
adapterManager.registerAdapter(dna);
dna.onLoad();
assertTrue("provider is not registered", adapterManager.getProviders().contains(testProvider));
// now deregister
dna.onUnload();
assertFalse("provider is still registered", adapterManager.getProviders().contains(testProvider));
watch.stop();
LOG.info("tested AdapterDeregistration --> " + watch);
}
示例11: testRegionCreation
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testRegionCreation() {
StopWatch watch = new StopWatch();
LOG.info("testing RegionCreation");
watch.start();
// create an instance Item
String logicalId = "/os/fake/regions/r1";
String name = "r1";
String provId = "fake";
ItemType type = new OsRegionType();
type.setId("os-" + type.getLocalId());
OsRegion item = new OsRegion(logicalId, type);
OsRegionAttributes ora = new OsRegionAttributes();
ora.setItemId(name);
ora.setItemName(name);
ora.setProviderId(provId);
item.setCore(ora);
assertEquals("Incorrect logicalId after creation", logicalId, item.getLogicalId());
assertEquals("Incorrect name after creation", name, item.getCore().getItemName());
assertEquals("Incorrect id after creation", name, item.getCore().getItemId());
assertEquals("Incorrect providerId after creation", provId, item.getCore().getProviderId());
assertEquals("Incorrect type after creation", type, item.getItemType());
watch.stop();
LOG.info("tested RegionCreation --> " + watch);
}
示例12: testUserDisconnected
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testUserDisconnected() throws NoSuchProviderException, DuplicateAdapterException,
NoSuchSessionException, SessionAlreadyExistsException, UserAlreadyConnectedException, NoSuchUserException,
DuplicateItemTypeException, NullItemTypeIdException, DuplicatePatternException, NullPatternIdException,
UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing UserDisconnected");
watch.start();
Provider prov = createProvider();
DoNothingAdapter dna = createUnregisteredDoNothingAdapter(prov);
adapterManager.registerAdapter(dna);
Session session = new SessionImpl("id1", sessionManager.getInterval());
aggregationManager.createSession(session);
stitcher.createSession(session);
adapterManager.userConnected(session, dna.getProvider(), null);
assertTrue("both sessions should be the same", session.equals(dna.getSession()));
adapterManager.userDisconnected(session, dna.getProvider(), null);
adapterManager.deregisterAdapter(dna, new HashSet<>(0));
watch.stop();
LOG.info("tested UserDisconnected --> " + watch);
}
示例13: testProcessBraidOneQuery
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testProcessBraidOneQuery() throws NoSuchSessionException, NoSuchTapestryDefinitionException,
IllegalAccessException, UnsupportedOperationException, OperationException, NoSuchAggregationException,
InvalidQueryInputException, LogicalIdAlreadyExistsException, NoSuchQueryDefinitionException,
NoSuchThreadDefinitionException, OperationNotSupportedException, InvalidQueryParametersException,
JsonProcessingException, PendingQueryResultsException, ItemPropertyNotFound, RelationPropertyNotFound,
IllegalArgumentException, ThreadDeletedByDynAdapterUnload {
tap = new TapestryDefinition();
tap.setThreads(braidOneThreads);
tapestryManager.setTapestryDefinition(session, tap);
StopWatch watch = new StopWatch();
LOG.info("testing Braid by One process");
watch.start();
QueryResult results = queryExec.processQuery(session, tap.getThreads().get(0));
//
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
System.out.println(mapper.writeValueAsString(results));
assertEquals(results.getElements().size(), 1);
QueryResult results2 =
queryExec.processQuery(session, tap.getThreads().get(0), braidOneQuery.hashCode() + "/id/0");
assertTrue(results2.getElements().size() == 20);
watch.stop();
LOG.info("tested Braid One Query process --> " + watch);
}
示例14: testRegisterItemTypeNullId
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = NullItemTypeIdException.class)
public void testRegisterItemTypeNullId() throws NoSuchProviderException, DuplicateAdapterException,
DuplicateItemTypeException, NullItemTypeIdException, NoSuchItemTypeException, DuplicatePatternException,
NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing RegisterItemTypeNullId");
watch.start();
Provider prov = createProvider();
adapterManager.registerAdapter(createUnregisteredDoNothingAdapter(prov));
ItemType fakeType = new FakeType();
fakeType.setLocalId(null);
adapterManager.addItemType(prov, fakeType);
watch.stop();
LOG.info("tested RegisterItemTypeNullId --> " + watch);
}
示例15: testRegisterItemTypeUnknownProvider
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testRegisterItemTypeUnknownProvider() throws NoSuchProviderException, DuplicateAdapterException,
DuplicateItemTypeException, NullItemTypeIdException, NoSuchItemTypeException {
StopWatch watch = new StopWatch();
LOG.info("testing RegisterItemTypeUnknownProvider");
watch.start();
Provider prov = createProvider();
createUnregisteredDoNothingAdapter(prov);
adapterManager.addItemType(prov, new FakeType());
watch.stop();
LOG.info("tested RegisterItemTypeUnknownProvider --> " + watch);
}