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;
}
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()));
}
}
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());
}
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());
}
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());
}
Aggregations