@Override public String toString() { if (startTickNanoSeconds == null) { return "Not Started"; } if (stopTickNanoSeconds == null) { return "Started but not stopped"; } return "Done. Duration: " + getDurationInMillis() + "ms"; } }
public synchronized Answer[] waitFor(int s) throws InterruptedException { if (_disconnected) { return null; } if (_answers != null) { return _answers; } Profiler profiler = new Profiler(); profiler.start(); if (s <= 0) { wait(); } else { int ms = s * 1000; wait(ms); } profiler.stop(); if (s_logger.isTraceEnabled()) { s_logger.trace("Synchronized command - sending completed, time: " + profiler.getDurationInMillis() + ", answer: " + (_answers != null ? _answers[0].toString() : "null")); } return _answers; }
if (s_logger.isDebugEnabled()) { s_logger.debug("Security Group Mgr v2: done scheduling ruleset updates for " + workItems.size() + " vms: num new jobs=" + newJobs + " num rows insert or updated=" + updated + " time taken=" + p.getDurationInMillis());
private String executePostMethod(final HttpClient client, final PostMethod method) { int response = 0; String result = null; try { final Profiler profiler = new Profiler(); profiler.start(); response = client.executeMethod(method); if (response == HttpStatus.SC_OK) { result = method.getResponseBodyAsString(); profiler.stop(); if (s_logger.isDebugEnabled()) { s_logger.debug("POST " + _serviceUrl + " response :" + result + ", responding time: " + profiler.getDurationInMillis() + " ms"); } } else { profiler.stop(); s_logger.error("Invalid response code : " + response + ", from : " + _serviceUrl + ", method : " + method.getParameter("method") + " responding time: " + profiler.getDurationInMillis()); } } catch (final HttpException e) { s_logger.error("HttpException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } catch (final IOException e) { s_logger.error("IOException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } catch (final Throwable e) { s_logger.error("Exception from : " + _serviceUrl + ", method : " + method.getParameter("method") + ", exception :", e); } finally { method.releaseConnection(); } return result; }
remainingMilliSeconds -= profiler.getDurationInMillis(); if (remainingMilliSeconds < 0) return false;
if (profiler.getDurationInMillis() > 1000) { if (s_logger.isDebugEnabled()) { s_logger.debug("Notifying management server join event took " + profiler.getDurationInMillis() + " ms"); s_logger.warn("Notifying management server join event took " + profiler.getDurationInMillis() + " ms"); if (profiler.getDurationInMillis() > 1000) { if (s_logger.isDebugEnabled()) { s_logger.debug("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms"); s_logger.warn("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms");
if (profiler.getDurationInMillis() >= HeartbeatInterval.value()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Peer scan takes too long to finish. profiler: " + profiler.toString() + ", profilerQueryActiveList: " +
profiler.stop(); if (profiler.getDurationInMillis() >= HeartbeatInterval.value()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Management server heartbeat takes too long to finish. profiler: " + profiler.toString() + ", profilerHeartbeatUpdate: " +
@Test public void testProfilerInMillis() { //Given final long sleepTimeMillis = SLEEP_TIME_NANO / 1000000L; //When pf.start(); pf.stop(); //Then Assert.assertTrue(pf.getDurationInMillis() == sleepTimeMillis); }
profiler.getDurationInMillis() + "ms. agent: " + pdu.getAgentId() + ", pdu seq: " + pdu.getSequenceId() + ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
@Override public String toString() { if (startTickNanoSeconds == null) { return "Not Started"; } if (stopTickNanoSeconds == null) { return "Started but not stopped"; } return "Done. Duration: " + getDurationInMillis() + "ms"; }
@Test public void testProfilerNoStart() { //Given final long expectedAnswer = -1; //When pf.stop(); //Then Assert.assertTrue(pf.getDurationInMillis() == expectedAnswer); Assert.assertFalse(pf.isStarted()); }
@Test public void testProfilerNoStop() { //Given final long expectedAnswer = -1; //When pf.start(); //Then Assert.assertTrue(pf.getDurationInMillis() == expectedAnswer); Assert.assertFalse(pf.isStopped()); } }
private String executePostMethod(final HttpClient client, final PostMethod method) { int response = 0; String result = null; try { final Profiler profiler = new Profiler(); profiler.start(); response = client.executeMethod(method); if (response == HttpStatus.SC_OK) { result = method.getResponseBodyAsString(); profiler.stop(); if (s_logger.isDebugEnabled()) { s_logger.debug("POST " + _serviceUrl + " response :" + result + ", responding time: " + profiler.getDurationInMillis() + " ms"); } } else { profiler.stop(); s_logger.error("Invalid response code : " + response + ", from : " + _serviceUrl + ", method : " + method.getParameter("method") + " responding time: " + profiler.getDurationInMillis()); } } catch (final HttpException e) { s_logger.error("HttpException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } catch (final IOException e) { s_logger.error("IOException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } finally { method.releaseConnection(); } return result; } }
remainingMilliSeconds -= profiler.getDurationInMillis(); if (remainingMilliSeconds < 0) { return false;
if (profiler.getDurationInMillis() > 1000) { if (s_logger.isDebugEnabled()) { s_logger.debug("Notifying management server join event took " + profiler.getDurationInMillis() + " ms"); s_logger.warn("Notifying management server join event took " + profiler.getDurationInMillis() + " ms"); if (profiler.getDurationInMillis() > 1000) { if (s_logger.isDebugEnabled()) { s_logger.debug("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms"); s_logger.warn("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms");
if (profiler.getDurationInMillis() >= HeartbeatInterval.value()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Peer scan takes too long to finish. profiler: " + profiler.toString() + ", profilerQueryActiveList: " +
profiler.getDurationInMillis() + "ms. agent: " + pdu.getAgentId() + ", pdu seq: " + pdu.getSequenceId() + ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
profiler.stop(); if (profiler.getDurationInMillis() >= HeartbeatInterval.value()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Management server heartbeat takes too long to finish. profiler: " + profiler.toString() + ", profilerHeartbeatUpdate: " +