/** * Increases the count by on for the given item. * * @param item */ public void inc(T item) { add(item, 1); }
/** * Increases the count by on for the given item. * * @param item */ public void inc(T item) { add(item, 1); }
int sampleRunnable(Runnable runnable) { if (runnable instanceof LocalEventDispatcher) { LocalEventDispatcher eventDispatcher = (LocalEventDispatcher) runnable; return sampleLocalDispatcherEvent(eventDispatcher); } occurrenceMap.add(runnable.getClass().getName(), 1); return 1; }
private void scan() { for (Invocation invocation : invocationRegistry) { occurrenceMap.add(toOperationDesc(invocation.op), 1); } }
int sampleRunnable(Runnable runnable) { if (runnable instanceof LocalEventDispatcher) { LocalEventDispatcher eventDispatcher = (LocalEventDispatcher) runnable; return sampleLocalDispatcherEvent(eventDispatcher); } occurrenceMap.add(runnable.getClass().getName(), 1); return 1; }
private void scan() { for (Invocation invocation : invocationRegistry) { occurrenceMap.add(toOperationDesc(invocation.op), 1); } }
/** * Samples the queue. * * @param q the queue to sample * @return the number of samples (if there were not sufficient samples, -1 is returned) */ private int sample(Queue<OutboundFrame> q) { packets.addAll(q); if (packets.size() < threshold) { return -1; } int sampleCount = min(samples, packets.size()); int actualSampleCount = 0; for (int k = 0; k < sampleCount; k++) { OutboundFrame packet = packets.get(random.nextInt(packets.size())); String key = toKey(packet); if (key != null) { actualSampleCount++; occurrenceMap.add(key, 1); } } return actualSampleCount; }
/** * Samples the queue. * * @param q the queue to sample * @return the number of samples (if there were not sufficient samples, -1 is returned) */ private int sample(Queue<OutboundFrame> q) { packets.addAll(q); if (packets.size() < threshold) { return -1; } int sampleCount = min(samples, packets.size()); int actualSampleCount = 0; for (int k = 0; k < sampleCount; k++) { OutboundFrame packet = packets.get(random.nextInt(packets.size())); String key = toKey(packet); if (key != null) { actualSampleCount++; occurrenceMap.add(key, 1); } } return actualSampleCount; }
private void updatePipelineState(MigratablePipeline pipeline) { long pipelineLoad = getLoadSinceLastCheck(pipeline); pipelineLoadCount.set(pipeline, pipelineLoad); NioThread owner = pipeline.owner(); if (owner == null) { // the pipeline is currently being migrated - owner is null return; } ownerLoad.add(owner, pipelineLoad); ownerToPipelines.get(owner).add(pipeline); }
private void updatePipelineState(MigratablePipeline pipeline) { long pipelineLoad = getLoadSinceLastCheck(pipeline); pipelineLoadCount.set(pipeline, pipelineLoad); NioThread owner = pipeline.owner(); if (owner == null) { // the pipeline is currently being migrated - owner is null return; } ownerLoad.add(owner, pipelineLoad); ownerToPipelines.get(owner).add(pipeline); }
EntryEventType type = EntryEventType.getByType(event.getEventType()); String mapName = event.getMapName(); occurrenceMap.add(format("IMap '%s' %s", mapName, type), 1); return 1; } else if (dispatcherEvent instanceof CacheEventSet) { Set<CacheEventData> events = eventSet.getEvents(); for (CacheEventData event : events) { occurrenceMap.add(format("ICache '%s' %s", event.getName(), event.getCacheEventType()), 1); occurrenceMap.add(format("IQueue '%s' %s", event.getName(), event.getEventType()), 1); return 1; } else if (dispatcherEvent instanceof CollectionEvent) { serviceName = "IList"; occurrenceMap.add(format("%s '%s' %s", serviceName, event.getName(), event.getEventType()), 1); return 1; occurrenceMap.add(dispatcherEvent.getClass().getSimpleName(), 1); return 1;
EntryEventType type = EntryEventType.getByType(event.getEventType()); String mapName = event.getMapName(); occurrenceMap.add(format("IMap '%s' %s", mapName, type), 1); return 1; } else if (dispatcherEvent instanceof CacheEventSet) { Set<CacheEventData> events = eventSet.getEvents(); for (CacheEventData event : events) { occurrenceMap.add(format("ICache '%s' %s", event.getName(), event.getCacheEventType()), 1); occurrenceMap.add(format("IQueue '%s' %s", event.getName(), event.getEventType()), 1); return 1; } else if (dispatcherEvent instanceof CollectionEvent) { serviceName = "IList"; occurrenceMap.add(format("%s '%s' %s", serviceName, event.getName(), event.getEventType()), 1); return 1; occurrenceMap.add(dispatcherEvent.getClass().getSimpleName(), 1); return 1;
private void runCurrent(DiagnosticsLogWriter writer, long now) { writer.startSection("Pending"); int count = 0; boolean maxPrinted = false; for (Invocation invocation : invocationRegistry) { long durationMs = now - invocation.firstInvocationTimeMillis; String operationDesc = toOperationDesc(invocation.op); occurrences.add(operationDesc, 1); if (durationMs < thresholdMillis) { // short invocation, lets move on to the next continue; } // it is a slow invocation count++; if (count < maxCount) { writer.writeEntry(invocation.toString() + " duration=" + durationMs + " ms"); } else if (!maxPrinted) { maxPrinted = true; writer.writeEntry("max number of invocations to print reached."); } slowOccurrences.add(operationDesc, 1); } writer.endSection(); }
private void runCurrent(DiagnosticsLogWriter writer, long now) { writer.startSection("Pending"); int count = 0; boolean maxPrinted = false; for (Invocation invocation : invocationRegistry) { long durationMs = now - invocation.firstInvocationTimeMillis; String operationDesc = toOperationDesc(invocation.op); occurrences.add(operationDesc, 1); if (durationMs < thresholdMillis) { // short invocation, lets move on to the next continue; } // it is a slow invocation count++; if (count < maxCount) { writer.writeEntry(invocation.toString() + " duration=" + durationMs + " ms"); } else if (!maxPrinted) { maxPrinted = true; writer.writeEntry("max number of invocations to print reached."); } slowOccurrences.add(operationDesc, 1); } writer.endSection(); }