public static <A extends Appendable> A appendNearestTimeUnit(A target, long nsValue, String postfix) { appendNearestTimeUnit(target, nsValue); try { target.append(postfix); } catch (IOException e) { throw new RuntimeException(e); } return target; }
public static <A extends Appendable> A appendNearestTimeUnit(A target, long nsValue, String postfix) { appendNearestTimeUnit(target, nsValue); try { target.append(postfix); } catch (IOException e) { throw new RuntimeException(e); } return target; }
public static <A extends Appendable> A appendNearestTimeUnit(A target, long nsValue, String postfix) { appendNearestTimeUnit(target, nsValue); try { target.append(postfix); } catch (IOException e) { throw new RuntimeException(e); } return target; }
private static void checkForLongRun(ScriptedNonThreadScheduler that) { //this must NOT be inside the lock because this visit can cause a modification //to this same scheduler which will require the lock. //TODO: disable until we fix slowness if (false && null!=that.checksForLongRuns && System.nanoTime()>that.nextLongRunningCheck) { long now = System.nanoTime(); //NOTE: this is only called by 1 of the nonThreadSchedulers and not often GraphManager.visitLongRunningStages(that.graphManager, that.checksForLongRuns ); ////// that.nextLongRunningCheck = System.nanoTime() + that.longRunningCheckFreqNS; long duration = System.nanoTime()-now; logger.info("Thread:{} checking for long runs, took {}",that.name, Appendables.appendNearestTimeUnit(new StringBuilder(), duration) ); } }
@Override public void timout(long responseTimeoutNS) { try { Appendables.appendNearestTimeUnit(target.append("Failed response detected after timeout of: "), responseTimeoutNS).append('\n'); } catch (IOException e) { throw new RuntimeException(e); } }
private static byte[] buildStageDOTRate(GraphManager m, PronghornStage stage) { Object rate = getNota(m, stage.stageId, GraphManager.SCHEDULE_RATE, null); if (null!=rate) { StringBuilder builder = new StringBuilder(); builder.append("\n Rate:"); Appendables.appendNearestTimeUnit(builder, ((Number)rate).longValue()); return m.stageDOTRate[stage.stageId] = builder.toString().getBytes(); } return null; }
public static boolean visitUsedByClass(String name, Object listener, ChildClassScannerVisitor visitor, Class target) { HashSet<Object> seen = new HashSet<Object>();//NOTE: should recycle this. long start = System.nanoTime(); boolean result = visitUsedByClass(name, listener, 0, visitor, listener, target, seen); long duration = System.nanoTime()-start; //just report the longest durations if (duration > SCAN_LIMIT_TIME_NS) { StringBuilder temp = new StringBuilder();//must create this just to show this rare error as a single block. Appendables.appendNearestTimeUnit(temp, duration); temp.append(" duration for scan to find all "); temp.append(target.getSimpleName()); temp.append(" instances inside "); temp.append(listener.getClass().getSimpleName()); System.out.println(temp); } return result; }
private void reportSLAViolation(String stageName, GraphManager gm, int inProgressIdx, long SLAStart, long duration) { int nameLen = stageName.indexOf('\n'); if (-1==nameLen) { nameLen = stageName.length(); } Appendables.appendEpochTime( Appendables.appendEpochTime( Appendables.appendNearestTimeUnit(System.err.append("SLA Violation: "), duration) .append(" ") .append(stageName.subSequence(0, nameLen)) .append(" ") ,SLAStart).append('-') ,System.currentTimeMillis()) .append(" ").append(gm.name).append("\n"); }
logger.error("Hang detected in: {} after timeout of "+Appendables.appendNearestTimeUnit(new StringBuilder(), timeout), String.valueOf(active)); globalRun.set(false); //stop all other detectors since they are likely to trigger with false positive.
public boolean isValid() { SocketChannel socketChannel = getSocketChannel(); if (null==socketChannel || (!socketChannel.isConnected()) ) { if (logDisconnects) { logger.info("{}:{} session {} is no longer connected. It was opened {} ago.", host,port,sessionId, Appendables.appendNearestTimeUnit(new StringBuilder(), System.nanoTime()-creationTimeNS).toString() ); } return false; } return isValid; }
public <A extends Appendable> A report(A target) { try { Appendables.appendValue(target.append("Total:"), totalCount).append("\n"); } catch (IOException e) { throw new RuntimeException(e); } Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .25f), " 25 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .50f), " 50 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .80f), " 80 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .90f), " 90 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .95f), " 95 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .98f), " 98 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .99f), " 99 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .999f), " 99.9 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .9999f), " 99.99 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .99999f), " 99.999 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, .999999f), " 99.9999 percentile\n"); Appendables.appendNearestTimeUnit(target, ElapsedTimeRecorder.elapsedAtPercentile(this, 1f), " max\n"); return target; }
@Override public void longCallDetected(int track, long duration, long now, long start) { Appendables.appendEpochTime( Appendables.appendEpochTime( Appendables.appendValue( Appendables.appendNearestTimeUnit(System.err, duration) .append(" long call detected for track:") ,(track)).append(" happend in window :") ,start).append(" - ") ,now).append("\n"); }
Appendables.appendNearestTimeUnit(target, testDuration).append(" test duration\n"); Appendables.appendValue(target, serverCallsPerSecond).append(" total calls per second against server\n"); Appendables.appendNearestTimeUnit(target, avgLatencyNS).append(" average\n"); } else { target.append("warning: zero messages tested\n");
,coordinator.maxConcurrentOutputs).append("\n"); Appendables.appendNearestTimeUnit(System.out, System.nanoTime() - this.startupTimeNS).append(" total startup time.\n");
private void abandonNow(ClientConnection abandonded) { Pipe<NetPayloadSchema> pipe = output[abandonded.getResponsePipeIdx()]; ///ensure that this will not cause any stall, better to skip this than be blocked. if (Pipe.hasRoomForWrite(pipe)) { long nowNS = System.nanoTime(); long callTime = abandonded.outstandingCallTime(nowNS); logger.warn("\nClient disconnected {} con:{} session:{} because call was taking too long. Estimated:{}", abandonded, abandonded.id, abandonded.sessionId,Appendables.appendNearestTimeUnit(new StringBuilder(), callTime)); abandonded.touchSentTime(nowNS);//rest the timeout so we do not attempt to close this again until the timeout has passed again. if (!abandonded.isDisconnecting()) { abandonded.beginDisconnect(); } int size = Pipe.addMsgIdx(pipe, NetPayloadSchema.MSG_DISCONNECT_203); Pipe.addLongValue(abandonded.getId(), pipe); Pipe.confirmLowLevelWrite(pipe, size); Pipe.publishWrites(pipe); //Do not set notification sent this message will trigger that one later once it makes it down the pipe. } }
ClientConnection conObjPrev = (ClientConnection)ccm.connectionObjForConnectionId(prevConnectionId, true); System.out.println("Con: "+conObjPrev.id+" registered:"+conObjPrev.isRegistered()+" valid:"+conObjPrev.isValid()+" Outstanding:" + Appendables.appendNearestTimeUnit(new StringBuilder(), conObjPrev.outstandingCallTime(System.nanoTime()))+" atIdx: "+prevConnectionId + " closedNoticeSent:"+conObjPrev.isClientClosedNotificationSent() );
+" calltime "+Appendables.appendNearestTimeUnit(new StringBuilder(), callTime).toString() +" isValid:"+t.isValid+" isReg:"+t.isRegistered()+" isDis:"+t.isDisconnecting +" sentClosedNotice:"+t.isClientClosedNotificationSent()
if (debug) { logger.info("Stage {} Elap {} ns ",getStage(gm,i).stageId, Appendables.appendNearestTimeUnit(new StringBuilder(), elapsedAtPercentile).toString() );
Appendables.appendNearestTimeUnit(System.out.append("avg "), avg).append("\r\n");