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; }
Profiler p = new Profiler(); p.start(); int updated = 0;
public boolean lock(int timeoutSeconds) { int remainingMilliSeconds = timeoutSeconds * 1000; Profiler profiler = new Profiler(); boolean interrupted = false; try {
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; }
@Before public void setUp() { pf = new Profiler(); PowerMockito.mockStatic(System.class); PowerMockito.when(System.nanoTime()).thenReturn(0L, SLEEP_TIME_NANO); }
private void peerScan() throws ActiveFencingException { final Date cutTime = DateUtil.currentGMTTime(); final Profiler profiler = new Profiler(); profiler.start(); final Profiler profilerQueryActiveList = new Profiler(); profilerQueryActiveList.start(); final List<ManagementServerHostVO> currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value())); profilerQueryActiveList.stop(); final Profiler profilerSyncClusterInfo = new Profiler(); profilerSyncClusterInfo.start(); final List<ManagementServerHostVO> removedNodeList = new ArrayList<ManagementServerHostVO>(); final Profiler profilerInvalidatedNodeList = new Profiler(); profilerInvalidatedNodeList.start(); final Profiler profilerRemovedList = new Profiler(); profilerRemovedList.start();
final Profiler profiler = new Profiler(); profiler.start();
RestAdapter restAdapter = new RestAdapter.Builder() //other stuff .setProfiler(new Profiler() { @Override public Object beforeCall() { return null; } @Override public void afterCall(RequestInformation requestInfo, long elapsedTime, int statusCode, Object beforeCallData) { //get what I need } }) .setLogLevel(RestAdapter.LogLevel.FULL).build();
loader.addTranslator(ClassPool.getDefault(), new Profiler()); try { if (args.length < 1) {
public boolean lock(final int timeoutSeconds) { int remainingMilliSeconds = timeoutSeconds * 1000; final Profiler profiler = new Profiler(); boolean interrupted = false; try {
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; } }
private void peerScan() throws ActiveFencingException { final Date cutTime = DateUtil.currentGMTTime(); final Profiler profiler = new Profiler(); profiler.start(); final Profiler profilerQueryActiveList = new Profiler(); profilerQueryActiveList.start(); final List<ManagementServerHostVO> currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value())); profilerQueryActiveList.stop(); final Profiler profilerSyncClusterInfo = new Profiler(); profilerSyncClusterInfo.start(); final List<ManagementServerHostVO> removedNodeList = new ArrayList<>(); final Profiler profilerInvalidatedNodeList = new Profiler(); profilerInvalidatedNodeList.start(); final Profiler profilerRemovedList = new Profiler(); profilerRemovedList.start();
final Profiler profiler = new Profiler(); profiler.start();