Search in sources :

Example 1 with Description

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;
}
Also used : Description(com.navercorp.pinpoint.testapp.util.Description) HashSet(java.util.HashSet)

Example 2 with Description

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;
}
Also used : HashMap(java.util.HashMap) CountDownLatch(java.util.concurrent.CountDownLatch) Description(com.navercorp.pinpoint.testapp.util.Description) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Description (com.navercorp.pinpoint.testapp.util.Description)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1