private void status() { int drainStatus; int pendingWrites; local.evictionLock.lock(); try { pendingWrites = local.writeBuffer().size(); drainStatus = local.drainStatus(); } finally { local.evictionLock.unlock(); } LocalTime elapsedTime = LocalTime.ofSecondOfDay(stopwatch.elapsed(TimeUnit.SECONDS)); System.out.printf("---------- %s ----------%n", elapsedTime); System.out.printf("Pending reads: %,d; writes: %,d%n", local.readBuffer.size(), pendingWrites); System.out.printf("Drain status = %s (%s)%n", STATUS[drainStatus], drainStatus); System.out.printf("Evictions = %,d%n", cache.stats().evictionCount()); System.out.printf("Size = %,d (max: %,d)%n", local.data.mappingCount(), operation.maxEntries); System.out.printf("Lock = [%s%n", StringUtils.substringAfter( local.evictionLock.toString(), "[")); System.out.printf("Pending tasks = %,d%n", ForkJoinPool.commonPool().getQueuedSubmissionCount()); long maxMemory = Runtime.getRuntime().maxMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); long allocatedMemory = Runtime.getRuntime().totalMemory(); System.out.printf("Max Memory = %,d bytes%n", maxMemory); System.out.printf("Free Memory = %,d bytes%n", freeMemory); System.out.printf("Allocated Memory = %,d bytes%n", allocatedMemory); System.out.println(); }
@Override protected int getQueueLength() { return fjPool.getQueuedSubmissionCount(); }
@Override public Integer getValue() { return fjPool().getQueuedSubmissionCount(); } });
@Override public int getQueuedSubmissionCount() { return fjPool().getQueuedSubmissionCount(); }
@Override public int getQueuedSubmissionCount() { return java.util.concurrent.ForkJoinPool.commonPool().getQueuedSubmissionCount(); }
/** * Gets a snapshot of the given ExecutorService. * * @param service The ExecutorService to request a snapshot on. * @return A Snapshot of the given ExecutorService, or null if not supported. */ public static Snapshot getSnapshot(ExecutorService service) { Preconditions.checkNotNull(service, "service"); if (service instanceof ThreadPoolExecutor) { val tpe = (ThreadPoolExecutor) service; return new Snapshot(tpe.getQueue().size(), tpe.getActiveCount(), tpe.getPoolSize()); } else if (service instanceof ForkJoinPool) { val fjp = (ForkJoinPool) service; return new Snapshot(fjp.getQueuedSubmissionCount(), fjp.getActiveThreadCount(), fjp.getPoolSize()); } else { return null; } }
long st = getStealCount(); long qt = getQueuedTaskCount(); long qs = getQueuedSubmissionCount(); int pc = parallelism; long c = ctl;
long st = getStealCount(); long qt = getQueuedTaskCount(); long qs = getQueuedSubmissionCount(); int pc = parallelism; long c = ctl;
long st = getStealCount(); long qt = getQueuedTaskCount(); long qs = getQueuedSubmissionCount(); int pc = parallelism; long c = ctl;
prefix, "queued_submissions"), executorService.getQueuedSubmissionCount()); metrics.setGauge( String.join(
@Override public ForkJoinInfo getInfo() { final ForkJoinPool fjPool = fjPool(); int activeThreadCount = fjPool.getActiveThreadCount(); // Returns an estimate of the number of threads that are currently stealing or executing tasks. int runningThreadCount = fjPool.getRunningThreadCount(); // Returns an estimate of the number of worker threads that are not blocked waiting to join tasks or for other managed synchronization. int queuedSumbmissionCount = fjPool.getQueuedSubmissionCount(); // Returns an estimate of the number of tasks submitted to this pool that have not yet begun executing. long queuedTaskCount = fjPool.getQueuedTaskCount(); // Returns an estimate of the total number of tasks currently held in queues by worker threads (but not including tasks submitted to the pool that have not begun executing). long stealCount = fjPool.getStealCount(); // Returns an estimate of the total number of tasks stolen from one thread's work queue by another. return new ForkJoinInfo(activeThreadCount, runningThreadCount, queuedSumbmissionCount, queuedTaskCount, stealCount); }
" poolSize=" + pool.getPoolSize() + " queuedTasks=" + pool.getQueuedTaskCount() + " queuedSubmissions=" + pool.getQueuedSubmissionCount() + " parallelism=" + pool.getParallelism() + " stealCount=" + pool.getStealCount());
createTimeSeriesStat( ServiceHostManagementService.STAT_NAME_EXECUTOR_QUEUE_DEPTH, executor.getQueuedSubmissionCount());