Search in sources :

Example 1 with PThreadState

use of com.navercorp.pinpoint.grpc.trace.PThreadState in project pinpoint by naver.

the class GrpcThreadDumpMessageConverter method toMessage.

@Override
public PThreadDump toMessage(Object message) {
    if (message instanceof ThreadDumpMetricSnapshot) {
        final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = (ThreadDumpMetricSnapshot) message;
        final PThreadDump.Builder threadDumpBuilder = PThreadDump.newBuilder();
        threadDumpBuilder.setThreadName(threadDumpMetricSnapshot.getThreadName());
        threadDumpBuilder.setThreadId(threadDumpMetricSnapshot.getThreadId());
        threadDumpBuilder.setBlockedTime(threadDumpMetricSnapshot.getBlockedTime());
        threadDumpBuilder.setBlockedCount(threadDumpMetricSnapshot.getBlockedCount());
        threadDumpBuilder.setWaitedTime(threadDumpMetricSnapshot.getWaitedTime());
        threadDumpBuilder.setWaitedCount(threadDumpMetricSnapshot.getWaitedCount());
        threadDumpBuilder.setInNative(threadDumpMetricSnapshot.isInNative());
        threadDumpBuilder.setSuspended(threadDumpMetricSnapshot.isSuspended());
        final PThreadState threadState = this.threadStateMessageConverter.toMessage(threadDumpMetricSnapshot.getThreadState());
        threadDumpBuilder.setThreadState(threadState);
        for (String stackTrace : threadDumpMetricSnapshot.getStackTrace()) {
            threadDumpBuilder.addStackTrace(stackTrace);
        }
        for (MonitorInfoMetricSnapshot monitorInfoMetricSnapshot : threadDumpMetricSnapshot.getLockedMonitors()) {
            final PMonitorInfo.Builder monitorInfoBuilder = PMonitorInfo.newBuilder();
            monitorInfoBuilder.setStackDepth(monitorInfoMetricSnapshot.getStackDepth());
            monitorInfoBuilder.setStackFrame(monitorInfoMetricSnapshot.getStackFrame());
            threadDumpBuilder.addLockedMonitor(monitorInfoBuilder.build());
        }
        if (threadDumpMetricSnapshot.getLockName() != null) {
            threadDumpBuilder.setLockName(threadDumpMetricSnapshot.getLockName());
        }
        threadDumpBuilder.setLockOwnerId(threadDumpMetricSnapshot.getLockOwnerId());
        if (threadDumpMetricSnapshot.getLockOwnerName() != null) {
            threadDumpBuilder.setLockOwnerName(threadDumpMetricSnapshot.getLockOwnerName());
        }
        for (String lockedSynchronizer : threadDumpMetricSnapshot.getLockedSynchronizers()) {
            threadDumpBuilder.addLockedSynchronizer(lockedSynchronizer);
        }
        return threadDumpBuilder.build();
    } else {
        return null;
    }
}
Also used : MonitorInfoMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot) PMonitorInfo(com.navercorp.pinpoint.grpc.trace.PMonitorInfo) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot) PThreadState(com.navercorp.pinpoint.grpc.trace.PThreadState) PThreadDump(com.navercorp.pinpoint.grpc.trace.PThreadDump)

Example 2 with PThreadState

use of com.navercorp.pinpoint.grpc.trace.PThreadState in project pinpoint by naver.

the class GrpcThreadDumpBoMapper method map.

public ThreadDumpBo map(final PThreadDump threadDump) {
    final ThreadDumpBo threadDumpBo = new ThreadDumpBo();
    threadDumpBo.setThreadName(threadDump.getThreadName());
    threadDumpBo.setThreadId(threadDump.getThreadId());
    threadDumpBo.setBlockedTime(threadDump.getBlockedTime());
    threadDumpBo.setBlockedCount(threadDump.getBlockedCount());
    threadDumpBo.setWaitedTime(threadDump.getWaitedTime());
    threadDumpBo.setWaitedCount(threadDump.getWaitedCount());
    threadDumpBo.setLockName(threadDump.getLockName());
    threadDumpBo.setLockOwnerId(threadDump.getLockOwnerId());
    threadDumpBo.setLockOwnerName(threadDump.getLockOwnerName());
    threadDumpBo.setInNative(threadDump.getInNative());
    threadDumpBo.setSuspended(threadDump.getSuspended());
    final PThreadState threadState = threadDump.getThreadState();
    threadDumpBo.setThreadState(this.threadStateMapper.map(threadState));
    threadDumpBo.setStackTraceList(threadDump.getStackTraceList());
    if (CollectionUtils.hasLength(threadDump.getLockedMonitorList())) {
        final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>();
        for (PMonitorInfo monitorInfo : threadDump.getLockedMonitorList()) {
            final MonitorInfoBo monitorInfoBo = this.monitorInfoBoMapper.map(monitorInfo);
            monitorInfoBoList.add(monitorInfoBo);
        }
        threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
    }
    threadDumpBo.setLockedSynchronizerList(threadDump.getLockedSynchronizerList());
    return threadDumpBo;
}
Also used : PMonitorInfo(com.navercorp.pinpoint.grpc.trace.PMonitorInfo) ArrayList(java.util.ArrayList) PThreadState(com.navercorp.pinpoint.grpc.trace.PThreadState) MonitorInfoBo(com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Aggregations

PMonitorInfo (com.navercorp.pinpoint.grpc.trace.PMonitorInfo)2 PThreadState (com.navercorp.pinpoint.grpc.trace.PThreadState)2 MonitorInfoBo (com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo)1 ThreadDumpBo (com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)1 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)1 MonitorInfoMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot)1 ThreadDumpMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)1 ArrayList (java.util.ArrayList)1