void record(long wallNanos, long cpuNanos) { this.calls.incrementAndGet(); this.wallNanos.addAndGet(wallNanos); this.cpuNanos.addAndGet(cpuNanos); }
private static void endCount(RpcStatus status, long elapsed, boolean succeeded) { status.active.decrementAndGet(); status.total.incrementAndGet(); status.totalElapsed.addAndGet(elapsed); if (status.maxElapsed.get() < elapsed) { status.maxElapsed.set(elapsed); } if (succeeded) { if (status.succeededMaxElapsed.get() < elapsed) { status.succeededMaxElapsed.set(elapsed); } } else { status.failed.incrementAndGet(); status.failedElapsed.addAndGet(elapsed); if (status.failedMaxElapsed.get() < elapsed) { status.failedMaxElapsed.set(elapsed); } } }
@Override public void messageBroadcastedTo(int numOccupants) { // Increment counter of received messages that where broadcasted by one inMessages.incrementAndGet(); // Increment counter of outgoing messages with the number of room occupants // that received the message outMessages.addAndGet(numOccupants); }
public void afterConnected(long delta) { connectingCount.decrementAndGet(); connectNanoTotal.addAndGet(delta); for (;;) { // connectNanoMax long max = connectNanoMax.get(); if (delta > max) { if (connectNanoMax.compareAndSet(max, delta)) { break; } else { continue; } } else { break; } } activeCount.incrementAndGet(); }
public Pair<Integer, Double> avgCheck(long one) { int send = counter.incrementAndGet(); long total = sum.addAndGet(one); Double pastSeconds = intervalCheck.checkAndGet(); if (pastSeconds != null) { counter.set(0); sum.set(0); Double avg = (double) 0; if (send != 0) { avg = ((double) total) / send; } return new Pair<>(send, avg); } return null; } }
public Double count(long value) { long totalValue = total.incrementAndGet(); long timesValue = times.incrementAndGet(); long v = values.addAndGet(value); Double pass = intervalCheck.checkAndGet(); if (pass != null) { times.set(0); values.set(0); Double tps = timesValue / pass; StringBuilder sb = new StringBuilder(); sb.append(id); sb.append(", tps:" + tps); sb.append(", avg:" + ((double) v) / timesValue); sb.append(", total:" + totalValue); LOG.info(sb.toString()); return tps; } return null; }
@Override public byte[] put(ByteBuffer key, byte[] value) numBytes.addAndGet(key.remaining() + value.length); Iterator<Map.Entry<ByteBuffer, byte[]>> it = entrySet().iterator(); List<ByteBuffer> keysToRemove = new ArrayList<>(); long totalEvictionSize = 0L; while (numBytes.get() - totalEvictionSize > sizeInBytes && it.hasNext()) { evictionCount.incrementAndGet(); if (logEvictions && evictionCount.get() % logEvictionCount == 0) { log.info( "Evicting %,dth element. Size[%,d], numBytes[%,d], averageSize[%,d]", evictionCount.get(), size(), numBytes.get(), numBytes.addAndGet(-key.remaining() - old.length);
private void updateCounters(final long increment) { final long newValue = bytesRead.addAndGet(increment); final long nextBound = firstPercentBound.longValue(); if ((newValue > nextBound) && (nextBound != 0L)) { final int percentage = Math.min(100, (int)Math.floor(100 * newValue/contentLength)); percentRead.set(percentage); // to next percentage value firstPercentBound.set((1 + percentRead.get()) * contentLength/100); propertyChangeSupport.firePropertyChange(PROGRESS, -1, percentage); } }
private static void endCount(RpcStatus status, long elapsed, boolean succeeded) { status.active.decrementAndGet(); status.total.incrementAndGet(); status.totalElapsed.addAndGet(elapsed); if (status.maxElapsed.get() < elapsed) { status.maxElapsed.set(elapsed); } if (succeeded) { if (status.succeededMaxElapsed.get() < elapsed) { status.succeededMaxElapsed.set(elapsed); } } else { status.failed.incrementAndGet(); status.failedElapsed.addAndGet(elapsed); if (status.failedMaxElapsed.get() < elapsed) { status.failedMaxElapsed.set(elapsed); } } }
void onResourceSuccess(String path, long nBytes) { successResource.incrementAndGet(); totalBytes.addAndGet(nBytes); }
public void add(final long delta) { while (true) { final long nextResetTimeMillis = nextResetTimeMillisRef.get(); final long currentTimeMillis = now(); if (currentTimeMillis < nextResetTimeMillis) { value.addAndGet(delta); return; } final long currentValue = value.get(); if (nextResetTimeMillisRef.compareAndSet(nextResetTimeMillis, Long.MAX_VALUE)) { value.addAndGet(delta - currentValue); nextResetTimeMillisRef.set(currentTimeMillis + resetIntervalMillis); return; } } }
@Override public void reportSuccessfulRequest(long durationTotalMillis) { numSuccessful.incrementAndGet(); successfulDuration.addAndGet(durationTotalMillis); }
public void handleCall(long nanoTime, Object context) { totalCalls.incrementAndGet(); totalTime.addAndGet(nanoTime); long oldMax = maxTime.get(); if (nanoTime > oldMax) { maxTime.compareAndSet(oldMax, nanoTime); if (MAX_CONTEXT) { maxContext = context; } } long microseconds = TimeUnit.MICROSECONDS.convert(nanoTime, TimeUnit.NANOSECONDS); totalSquareMicroseconds.addAndGet(microseconds * microseconds); }
@Override public void request(long n) { if (Long.MAX_VALUE == n) { requested.set(Long.MAX_VALUE); maxValueRequestedCount.incrementAndGet(); } else if (n <= 0) { negativeRequestCount.incrementAndGet(); } requested.addAndGet(n); }
public Double count(long value) { long totalValue = total.incrementAndGet(); long timesValue = times.incrementAndGet(); long v = values.addAndGet(value); Double pass = intervalCheck.checkAndGet(); if (pass != null) { times.set(0); values.set(0); Double tps = timesValue / pass; StringBuilder sb = new StringBuilder(); sb.append(id); sb.append(", tps:" + tps); sb.append(", avg:" + ((double) v) / timesValue); sb.append(", total:" + totalValue); LOG.info(sb.toString()); return tps; } return null; }
/** * Init. * * @param serverNodeId the server node id */ public static void init(int serverNodeId) { try { UUID.set(UUID_INTERNAL * serverNodeId); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); Date date = format.parse("2019-01-01"); cal.setTime(date); long base = cal.getTimeInMillis(); long current = System.currentTimeMillis(); UUID.addAndGet((current - base) / 1000); } catch (ParseException e) { throw new ShouldNeverHappenException(e); } } }
public void addValue(long v) { nb.incrementAndGet(); if (nb.get() == 1) { min.set(v); max.set(v); } else if (v > max.get()) { max.set(v); } else if (v < min.get()) { min.set(v); } sum.addAndGet(v); sumOfSquare.addAndGet(v * v); sliddingSum.set(sliddingSum.get() * (SLIDING_WINDOW - 1) / SLIDING_WINDOW + v); }