Search in sources :

Example 1 with MonitorInfoMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot in project pinpoint by naver.

the class ThreadDumpThriftMessageConverter method toMessage.

@Override
public TThreadDump toMessage(Object message) {
    if (message instanceof ThreadDumpMetricSnapshot) {
        final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = (ThreadDumpMetricSnapshot) message;
        final TThreadDump threadDump = new TThreadDump();
        threadDump.setThreadName(threadDumpMetricSnapshot.getThreadName());
        threadDump.setThreadId(threadDumpMetricSnapshot.getThreadId());
        threadDump.setBlockedTime(threadDumpMetricSnapshot.getBlockedTime());
        threadDump.setBlockedCount(threadDumpMetricSnapshot.getBlockedCount());
        threadDump.setWaitedTime(threadDumpMetricSnapshot.getWaitedTime());
        threadDump.setWaitedCount(threadDumpMetricSnapshot.getWaitedCount());
        threadDump.setInNative(threadDumpMetricSnapshot.isInNative());
        threadDump.setSuspended(threadDumpMetricSnapshot.isSuspended());
        final TThreadState threadState = this.threadStateMessageConverter.toMessage(threadDumpMetricSnapshot.getThreadState());
        threadDump.setThreadState(threadState);
        for (String stackTrace : threadDumpMetricSnapshot.getStackTrace()) {
            threadDump.addToStackTrace(stackTrace);
        }
        for (MonitorInfoMetricSnapshot monitorInfoMetricSnapshot : threadDumpMetricSnapshot.getLockedMonitors()) {
            final TMonitorInfo tMonitorInfo = new TMonitorInfo();
            tMonitorInfo.setStackDepth(monitorInfoMetricSnapshot.getStackDepth());
            tMonitorInfo.setStackFrame(monitorInfoMetricSnapshot.getStackFrame());
            threadDump.addToLockedMonitors(tMonitorInfo);
        }
        threadDump.setLockName(threadDumpMetricSnapshot.getLockName());
        threadDump.setLockOwnerId(threadDumpMetricSnapshot.getLockOwnerId());
        threadDump.setLockOwnerName(threadDumpMetricSnapshot.getLockOwnerName());
        for (String lockedSynchronizer : threadDumpMetricSnapshot.getLockedSynchronizers()) {
            threadDump.addToLockedSynchronizers(lockedSynchronizer);
        }
        return threadDump;
    } else {
        return null;
    }
}
Also used : TThreadState(com.navercorp.pinpoint.thrift.dto.command.TThreadState) TMonitorInfo(com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo) MonitorInfoMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)

Example 2 with MonitorInfoMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot 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 3 with MonitorInfoMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot in project pinpoint by naver.

the class ThreadDumpUtils method setMonitorInfo.

private static void setMonitorInfo(ThreadDumpMetricSnapshot threadDump, ThreadInfo threadInfo) {
    MonitorInfo[] monitorInfos = threadInfo.getLockedMonitors();
    if (monitorInfos != null) {
        for (MonitorInfo each : monitorInfos) {
            if (each == null) {
                continue;
            }
            MonitorInfoMetricSnapshot monitorInfoMetricSnapshot = new MonitorInfoMetricSnapshot();
            monitorInfoMetricSnapshot.setStackDepth(each.getLockedStackDepth());
            monitorInfoMetricSnapshot.setStackFrame(each.getLockedStackFrame().toString());
            threadDump.addLockedMonitor(monitorInfoMetricSnapshot);
        }
    } else {
        threadDump.setLockedMonitors(Collections.<MonitorInfoMetricSnapshot>emptyList());
    }
}
Also used : MonitorInfo(java.lang.management.MonitorInfo) MonitorInfoMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot)

Aggregations

MonitorInfoMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot)3 ThreadDumpMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)2 PMonitorInfo (com.navercorp.pinpoint.grpc.trace.PMonitorInfo)1 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)1 PThreadState (com.navercorp.pinpoint.grpc.trace.PThreadState)1 TMonitorInfo (com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo)1 TThreadDump (com.navercorp.pinpoint.thrift.dto.command.TThreadDump)1 TThreadState (com.navercorp.pinpoint.thrift.dto.command.TThreadState)1 MonitorInfo (java.lang.management.MonitorInfo)1