Search in sources :

Example 6 with TCmdActiveThreadCountRes

use of com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes in project pinpoint by naver.

the class ActiveThreadCountService method getActiveThreadCountResponse.

private TCmdActiveThreadCountRes getActiveThreadCountResponse() {
    ActiveTraceHistogram activeTraceHistogram = this.activeTraceHistogramFactory.createHistogram();
    TCmdActiveThreadCountRes response = new TCmdActiveThreadCountRes();
    response.setHistogramSchemaType(activeTraceHistogram.getHistogramSchema().getTypeCode());
    response.setActiveThreadCount(activeTraceHistogram.getActiveTraceCounts());
    response.setTimeStamp(System.currentTimeMillis());
    return response;
}
Also used : TCmdActiveThreadCountRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes) ActiveTraceHistogram(com.navercorp.pinpoint.profiler.context.active.ActiveTraceHistogramFactory.ActiveTraceHistogram)

Example 7 with TCmdActiveThreadCountRes

use of com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes in project pinpoint by naver.

the class ActiveThreadServiceTest method serviceTest1.

@Test
public void serviceTest1() throws InterruptedException {
    ActiveTraceRepository activeTraceRepository = new DefaultActiveTraceRepository();
    addActiveTrace(activeTraceRepository, FAST_EXECUTION_TIME, FAST_COUNT);
    addActiveTrace(activeTraceRepository, NORMAL_EXECUTION_TIME, NORMAL_COUNT);
    addActiveTrace(activeTraceRepository, SLOW_EXECUTION_TIME, SLOW_COUNT);
    addActiveTrace(activeTraceRepository, VERY_SLOW_EXECUTION_TIME, VERY_SLOW_COUNT);
    ActiveThreadCountService service = new ActiveThreadCountService(activeTraceRepository);
    TBase<?, ?> tBase = service.requestCommandService(new TCmdActiveThreadCount());
    if (tBase instanceof TCmdActiveThreadCountRes) {
        List<Integer> activeThreadCount = ((TCmdActiveThreadCountRes) tBase).getActiveThreadCount();
        Assert.assertThat(activeThreadCount.get(0), is(FAST_COUNT));
        Assert.assertThat(activeThreadCount.get(1), is(NORMAL_COUNT));
        Assert.assertThat(activeThreadCount.get(2), is(SLOW_COUNT));
        Assert.assertThat(activeThreadCount.get(3), is(VERY_SLOW_COUNT));
    } else {
        Assert.fail();
    }
}
Also used : ActiveTraceRepository(com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository) DefaultActiveTraceRepository(com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository) DefaultActiveTraceRepository(com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository) TCmdActiveThreadCountRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes) TCmdActiveThreadCount(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount) Test(org.junit.Test)

Aggregations

TCmdActiveThreadCountRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes)7 Test (org.junit.Test)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ActiveTraceHistogram (com.navercorp.pinpoint.profiler.context.active.ActiveTraceHistogramFactory.ActiveTraceHistogram)1 ActiveTraceRepository (com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository)1 DefaultActiveTraceRepository (com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository)1 TCmdActiveThreadCount (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount)1 Map (java.util.Map)1