public void updateLastReceivedRptMsg() { this.lastReceivedRptMsgTimestamp = StatisticsUtil.getCurrentTimestampInSeconds(); this.receivedRptMsgCount++; }
public SessionState getSessionState(final PCEPSession session) { Preconditions.checkNotNull(session); final SessionState state = new SessionState(); state.setLocalPref(this.localPref); state.setPeerPref(this.peerPref); state.setMessages(getMessageStats(session.getMessages())); state.setSessionDuration(StatisticsUtil.formatElapsedTime(this.sessionUpDuration.elapsed(TimeUnit.SECONDS))); return state; }
@Override public BgpSessionState getBgpSessionState() { final MessagesStats msgs = new MessagesStats(); msgs.setTotalMsgs(this.totalMsgs); msgs.setErrorMsgs(this.errMsgs); msgs.setKeepAliveMsgs(this.kaMsgs); msgs.setUpdateMsgs(this.updMsgs); msgs.setRouteRefreshMsgs(this.rrMsgs); this.stats.setSessionDuration(StatisticsUtil.formatElapsedTime(this.sessionStopwatch.elapsed(TimeUnit.SECONDS))); this.stats.setSessionState(this.session.getState().toString()); this.stats.setMessagesStats(msgs); return this.stats; }
public void updateLastSentMsg() { this.lastSentMsgTimestamp = StatisticsUtil.getCurrentTimestampInSeconds(); this.sentMsgCount++; }
private static void updateSentMsg(final Sent sent) { Preconditions.checkNotNull(sent); final long count = sent.getCount() == null ? 0L : sent.getCount().getValue(); sent.setCount(new ZeroBasedCounter32(count + 1)); sent.setTimestamp(new Timestamp(StatisticsUtil.getCurrentTimestampInSeconds())); }
private static void updateReceivedMsg(final Received received) { Preconditions.checkNotNull(received); final long count = received.getCount() == null ? 0L : received.getCount().getValue(); received.setCount(new ZeroBasedCounter32(count + 1)); received.setTimestamp(new Timestamp(StatisticsUtil.getCurrentTimestampInSeconds())); }
private void updateSentMsgErr(@Nonnull final Notify error) { Preconditions.checkNotNull(error); final List<ErrorSent> errList = this.errMsgs.getErrorSent(); ErrorSent sent = null; for (ErrorSent err : errList) { if (err.getErrorCode().equals(error.getErrorCode()) && err.getErrorSubcode().equals(error.getErrorSubcode())) { sent = err; break; } } if (null == sent) { sent = new ErrorSent(); sent.setErrorCode(error.getErrorCode()); sent.setErrorSubcode(error.getErrorSubcode()); sent.setCount(new ZeroBasedCounter32(0L)); errList.add(sent); } sent.setCount(new ZeroBasedCounter32(sent.getCount().getValue() + 1)); final Timestamp curTimestamp = new Timestamp(StatisticsUtil.getCurrentTimestampInSeconds()); sent.setTimestamp(curTimestamp); this.errMsgsSentTotal.setCount(new ZeroBasedCounter32(this.errMsgsSentTotal.getCount().getValue() + 1)); this.errMsgsSentTotal.setTimestamp(curTimestamp); }
private void updateReceivedMsgErr(@Nonnull final Notify error) { Preconditions.checkNotNull(error); final List<ErrorReceived> errList = this.errMsgs.getErrorReceived(); ErrorReceived received = null; for (ErrorReceived err : errList) { if (err.getErrorCode().equals(error.getErrorCode()) && err.getErrorSubcode().equals(error.getErrorSubcode())) { received = err; break; } } if (null == received) { received = new ErrorReceived(); received.setErrorCode(error.getErrorCode()); received.setErrorSubcode(error.getErrorSubcode()); received.setCount(new ZeroBasedCounter32(0L)); errList.add(received); } received.setCount(new ZeroBasedCounter32(received.getCount().getValue() + 1)); final Timestamp curTimestamp = new Timestamp(StatisticsUtil.getCurrentTimestampInSeconds()); received.setTimestamp(curTimestamp); this.errMsgsRecvTotal.setCount(new ZeroBasedCounter32(this.errMsgsRecvTotal.getCount().getValue() + 1)); this.errMsgsRecvTotal.setTimestamp(curTimestamp); }