Search in sources :

Example 16 with ActiveTraceSnapshot

use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.

the class ActiveThreadLightDumpServiceTest method extractThreadNameList.

private List<String> extractThreadNameList(List<ActiveTraceSnapshot> activeTraceInfoList, int size) {
    List<ActiveTraceSnapshot> activeTraceSnapshotList = shuffle(activeTraceInfoList);
    List<String> threadNameList = new ArrayList<String>(size);
    for (int i = 0; i < size; i++) {
        final ActiveTraceSnapshot activeTraceSnapshot = activeTraceSnapshotList.get(i);
        final long threadId = activeTraceSnapshot.getThreadId();
        ThreadInfo thread = ThreadMXBeanUtils.getThreadInfo(threadId);
        threadNameList.add(thread.getThreadName());
    }
    return threadNameList;
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) ArrayList(java.util.ArrayList) UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)

Example 17 with ActiveTraceSnapshot

use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.

the class ActiveThreadLightDumpServiceTest method basicFunctionTest5.

@Test
public void basicFunctionTest5() throws Exception {
    List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, JOB_TIMEOUT);
    List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
    int limit = 3;
    List<Long> oldTimeList = getOldTimeList(limit);
    TCmdActiveThreadLightDump tCmdActiveThreadDump = createRequest(limit, null, null);
    ActiveThreadLightDumpService service = createService(activeTraceInfoList);
    TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(tCmdActiveThreadDump);
    Assert.assertEquals(limit, response.getThreadDumpsSize());
    for (TActiveThreadLightDump dump : response.getThreadDumps()) {
        Assert.assertTrue(oldTimeList.contains(dump.getStartTime()));
    }
}
Also used : TCmdActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump) TCmdActiveThreadLightDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes) UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump) Test(org.junit.Test)

Example 18 with ActiveTraceSnapshot

use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.

the class ActiveThreadDumpServiceTest method basicFunctionTest2.

@Test
public void basicFunctionTest2() {
    List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, 1000 * 3);
    List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
    TCmdActiveThreadDump tCmdActiveThreadDump = createRequest(0, null, Arrays.asList(1L));
    ActiveThreadDumpService service = createService(activeTraceInfoList);
    TCmdActiveThreadDumpRes response = (TCmdActiveThreadDumpRes) service.requestCommandService(tCmdActiveThreadDump);
    Assert.assertEquals(1, response.getThreadDumpsSize());
}
Also used : UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TCmdActiveThreadDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDump) TCmdActiveThreadDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes) Test(org.junit.Test)

Example 19 with ActiveTraceSnapshot

use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.

the class ActiveThreadDumpServiceTest method basicFunctionTest4.

@Test
public void basicFunctionTest4() {
    List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, 1000 * 3);
    List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
    List<ActiveTraceSnapshot> copied = shuffle(activeTraceInfoList);
    int targetThreadNameSize = 3;
    List<String> threadNameList = extractThreadNameList(copied.subList(0, targetThreadNameSize), targetThreadNameSize);
    int targetTraceIdSize = 3;
    List<Long> localTraceIdList = extractLocalTraceIdList(copied.subList(targetThreadNameSize, CREATE_SIZE), targetTraceIdSize);
    TCmdActiveThreadDump tCmdActiveThreadDump = createRequest(0, threadNameList, localTraceIdList);
    ActiveThreadDumpService service = createService(activeTraceInfoList);
    TCmdActiveThreadDumpRes response = (TCmdActiveThreadDumpRes) service.requestCommandService(tCmdActiveThreadDump);
    Assert.assertEquals(targetThreadNameSize + targetTraceIdSize, response.getThreadDumpsSize());
}
Also used : UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TCmdActiveThreadDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDump) TCmdActiveThreadDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes) Test(org.junit.Test)

Example 20 with ActiveTraceSnapshot

use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.

the class ActiveThreadDumpServiceTest method basicFunctionTest1.

@Test
public void basicFunctionTest1() {
    List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, JOB_TIMEOUT);
    List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
    ActiveThreadDumpService service = createService(activeTraceInfoList);
    TCmdActiveThreadDumpRes response = (TCmdActiveThreadDumpRes) service.requestCommandService(createRequest(0, null, null));
    Assert.assertEquals(CREATE_SIZE, response.getThreadDumpsSize());
}
Also used : UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TCmdActiveThreadDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes) Test(org.junit.Test)

Aggregations

ActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)21 UnsampledActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot)15 Test (org.junit.Test)10 ThreadInfo (java.lang.management.ThreadInfo)8 TCmdActiveThreadDumpRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes)5 TCmdActiveThreadLightDumpRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes)5 ArrayList (java.util.ArrayList)5 TCmdActiveThreadDump (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDump)4 TCmdActiveThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump)4 ThreadDumpMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)2 TActiveThreadDump (com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump)2 TActiveThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)2 PActiveThreadDump (com.navercorp.pinpoint.grpc.trace.PActiveThreadDump)1 PActiveThreadLightDump (com.navercorp.pinpoint.grpc.trace.PActiveThreadLightDump)1 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)1 PThreadLightDump (com.navercorp.pinpoint.grpc.trace.PThreadLightDump)1 TThreadDump (com.navercorp.pinpoint.thrift.dto.command.TThreadDump)1 TThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TThreadLightDump)1