use of com.navercorp.pinpoint.testapp.util.Description in project pinpoint by naver.
the class ApisController method createRequestMappedApis.
private Set<RequestMappedUri> createRequestMappedApis(HandlerMethod handlerMethod, Set<String> mappedUris) {
if (CollectionUtils.isEmpty(mappedUris)) {
return Collections.emptySet();
}
Set<RequestMappedUri> requestMappedUris = new HashSet<RequestMappedUri>(mappedUris.size());
Description description = handlerMethod.getMethodAnnotation(Description.class);
for (String mappedUri : mappedUris) {
requestMappedUris.add(new RequestMappedUri(mappedUri, description));
}
return requestMappedUris;
}
use of com.navercorp.pinpoint.testapp.util.Description in project pinpoint by naver.
the class StressController method consumeCpu.
@RequestMapping("/consumeCpu")
@ResponseBody
@Description("Call that consumes a lot of cpu time.")
public Map<String, Object> consumeCpu() throws InterruptedException {
int cpuCount = Runtime.getRuntime().availableProcessors();
int threadSize = Math.max(1, cpuCount - 1);
long limitTime = 10000;
CountDownLatch latch = new CountDownLatch(threadSize);
for (int i = 0; i < threadSize; i++) {
Thread thread = new Thread(new ConsumeCpu(latch, limitTime));
thread.setDaemon(true);
thread.start();
}
latch.await();
Map<String, Object> map = new HashMap<String, Object>();
map.put("message", "ok");
return map;
}
Aggregations