/** * Increases the count by on for the given item. * * @param item */ public void inc(T item) { add(item, 1); }
/** * @param pipeline * @return load recorded by the pipeline */ long getLoad(MigratablePipeline pipeline) { return pipelineLoadCounter.get(pipeline); } }
private void write(DiagnosticsLogWriter writer, String text, ItemCounter<String> samples) { writer.startSection(text); long total = samples.total(); for (String name : samples.descendingKeys()) { long s = samples.get(name); writer.writeKeyValueEntry(name, s + " " + (HUNDRED * s / total) + "%"); } writer.endSection(); }
private void renderSamples(DiagnosticsLogWriter writer, int sampleCount) { writer.startSection("samples"); for (String key : occurrenceMap.keySet()) { long value = occurrenceMap.get(key); if (value == 0) { continue; } double percentage = (1d * value) / sampleCount; writer.writeEntry(key + " sampleCount=" + value + " " + defaultFormat.format(percentage)); } occurrenceMap.reset(); writer.endSection(); }
private void renderSamples(DiagnosticsLogWriter writer, int sampleCount) { writer.startSection("samples"); for (String key : occurrenceMap.keySet()) { long value = occurrenceMap.get(key); if (value == 0) { continue; } double percentage = (1d * value) / sampleCount; writer.writeEntry(key + " sampleCount=" + value + " " + defaultFormat.format(percentage)); } writer.endSection(); }
private void renderSlowHistory(DiagnosticsLogWriter writer) { writer.startSection("SlowHistory"); for (String item : slowOccurrences.descendingKeys()) { writer.writeEntry(item + " samples=" + slowOccurrences.get(item)); } writer.endSection(); } }
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 clean() { occurrenceMap.reset(); }
private long getLoadSinceLastCheck(MigratablePipeline pipeline) { long load = pipeline.load(); long lastLoad = lastLoadCounter.getAndSet(pipeline, load); return load - lastLoad; }
private void sample(OperationRunner[] runners, ItemCounter<String> samples) { for (OperationRunner runner : runners) { Object task = runner.currentTask(); if (task != null) { samples.inc(toKey(task)); } } }
private void write(DiagnosticsLogWriter writer, String text, ItemCounter<String> samples) { writer.startSection(text); long total = samples.total(); for (String name : samples.descendingKeys()) { long s = samples.get(name); writer.writeKeyValueEntry(name, s + " " + (HUNDRED * s / total) + "%"); } writer.endSection(); }
private void renderSamples(DiagnosticsLogWriter writer, int sampleCount) { writer.startSection("samples"); for (String key : occurrenceMap.keySet()) { long value = occurrenceMap.get(key); if (value == 0) { continue; } double percentage = (1d * value) / sampleCount; writer.writeEntry(key + " sampleCount=" + value + " " + defaultFormat.format(percentage)); } occurrenceMap.reset(); writer.endSection(); }
private void renderHistory(DiagnosticsLogWriter writer) { writer.startSection("History"); for (String item : occurrences.descendingKeys()) { writer.writeEntry(item + " samples=" + occurrences.get(item)); } writer.endSection(); }
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 clean() { occurrenceMap.reset(); }
private long getLoadSinceLastCheck(MigratablePipeline pipeline) { long load = pipeline.load(); long lastLoad = lastLoadCounter.getAndSet(pipeline, load); return load - lastLoad; }
private void sample(OperationRunner[] runners, ItemCounter<String> samples) { for (OperationRunner runner : runners) { Object task = runner.currentTask(); if (task != null) { samples.inc(toKey(task)); } } }
private void renderSamples(DiagnosticsLogWriter writer, int sampleCount) { writer.startSection("samples"); for (String key : occurrenceMap.keySet()) { long value = occurrenceMap.get(key); if (value == 0) { continue; } double percentage = (1d * value) / sampleCount; writer.writeEntry(key + " sampleCount=" + value + " " + defaultFormat.format(percentage)); } writer.endSection(); }