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