@Override public void rollCycle() { executionData.add(currentExecutionData); allocationData.add(currentAllocationData); spikeData.forEachEntry(decayLargestExecutionTime); currentExecutionData.forEachEntry(updateExecutionTimeTotalAndSpikeData); currentAllocationData.forEachEntry(updateAllocatedMemoryTotal); while (executionData.size() > RETAINED_CYCLES) { executionData.get(0).forEachEntry(removeExpiredExecutionTimeValueFromTotal); executionData.remove(0); } while (allocationData.size() > RETAINED_CYCLES) { allocationData.get(0).forEachEntry(removeExpiredAllocatedMemoryValueFromTotal); allocationData.remove(0); } currentExecutionData = new TObjectLongHashMap<>(); currentAllocationData = new TObjectLongHashMap<>(); }
public PerformanceMonitorImpl() { activityStack = Queues.newArrayDeque(); executionData = Lists.newLinkedList(); allocationData = Lists.newLinkedList(); currentExecutionData = new TObjectLongHashMap<>(); currentAllocationData = new TObjectLongHashMap<>(); runningExecutionTotals = new TObjectLongHashMap<>(); runningAllocationTotals = new TObjectLongHashMap<>(); spikeData = new TObjectDoubleHashMap<>(); decayLargestExecutionTime = new DecayerOfActivityLargestExecutionTime(); updateExecutionTimeTotalAndSpikeData = new UpdaterOfActivityExecutionTimeTotalAndSpikeData(); updateAllocatedMemoryTotal = new UpdaterOfActivityAllocatedMemoryTotal(); removeExpiredExecutionTimeValueFromTotal = new RemoverFromTotalOfActivityExpiredExecutionTimeValue(); removeExpiredAllocatedMemoryValueFromTotal = new RemoverFromTotalOfActivityExpiredAllocatedMemoryValue(); setExecutionTimeRunningMean = new SetterOfActivityToRunningMeanMapEntry(); setAllocatedMemoryRunningMean = new SetterOfActivityToRunningMeanMapEntry(); timer = (EngineTime) CoreRegistry.get(Time.class); mainThread = Thread.currentThread(); }
/** * Creates an empty {@code Counter}. */ public BigObjectCounter() { counts = new TObjectLongHashMap<T>(); sum = 0; }
public MultiStore(final MeasurementStore... stores) { if (stores.length <= 1) { throw new IllegalArgumentException("You need to supply more than 1 store, not " + Arrays.toString(stores)); } this.stores = stores; this.idToIds = new TLongObjectHashMap<>(); this.infoToId = new TObjectLongHashMap<>(); this.idSeq = 1L; }
public TscStreamReductor() { this(new TLongHashSet(), new TObjectLongHashMap<>()); }
@JmxExport public static synchronized void start(@JmxExport("sampleTimeMillis") final int sampleTime) { if (samplingFuture == null) { final MeasurementRecorder gcUsage = RecorderFactory.createDirectRecorder("gc-time", "ms", sampleTime); samplingFuture = DefaultScheduler.INSTANCE.scheduleWithFixedDelay(new AbstractRunnable() { private final TObjectLongMap lastValues = new TObjectLongHashMap(); @Override public void doRun() { synchronized (lastValues) { gcUsage.record(getGCTimeDiff(MBEANS, lastValues)); } } }, sampleTime, sampleTime, TimeUnit.MILLISECONDS); } else { throw new IllegalStateException("GC usage sampling already started " + samplingFuture); } }
ScalableMeasurementRecorderSource(final MeasurementAccumulator processor, final int sampleTimeMillis, final MeasurementStore database, final boolean closeOnShutdown) { if (sampleTimeMillis < 1000) { throw new IllegalArgumentException("sample time needs to be at least 1000 and not " + sampleTimeMillis); } this.processorTemplate = processor; measurementProcessorMap = new HashMap<>(); threadLocalMeasurementProcessorMap = new ThreadLocal<Map<Object, MeasurementAccumulator>>() { @Override protected Map<Object, MeasurementAccumulator> initialValue() { Map<Object, MeasurementAccumulator> result = new HashMap<>(); synchronized (measurementProcessorMap) { measurementProcessorMap.put(Thread.currentThread(), result); } return result; } }; tableIds = new TObjectLongHashMap<>(); persister = new Persister(database, sampleTimeMillis, processor); samplingFuture = DefaultScheduler.scheduleAllignedAtFixedRateMillis(persister, sampleTimeMillis); if (closeOnShutdown) { shutdownHook = closeOnShutdown(); } else { shutdownHook = null; } }
FileBasedSentenceReader sentenceReader = (FileBasedSentenceReader)Factory.create(filterParams.get(Configuration.SENTENCE_READER_CLASS), filterParams); long minCount = filterParams.getLong(Configuration.MIN_COUNT); TObjectLongMap<String> countMap = new TObjectLongHashMap<String>(); PrintStream out = new PrintStream(new FileOutputStream(filterParams.get(Configuration.OUTFILE)),false,filterParams.get(Configuration.ENCODING));
private void getDecomposersFor(List<MolecularFormula> pmds, FormulaConstraints constraint, List<MassToFormulaDecomposer> decomposers, List<FormulaConstraints> constraintList) { pmds = new ArrayList<>(pmds); final TObjectLongHashMap<Element> elementMap = new TObjectLongHashMap<>(10, 0.75f, -1); final TLongObjectHashMap<MassToFormulaDecomposer> decomposerMap = new TLongObjectHashMap<>(10); final long[] buf = new long[2];
public StatsWordMatch() { this.available = new HashMap<String,Pattern>(); addAvail(new EmoticonPatternProvider()); addAvail(new URLPatternProvider()); addAvail(new TimePatternProvider()); addAvail(new PunctuationPatternProvider()); TwitterStuffPatternProvider tpp = new TwitterStuffPatternProvider(); addAvail("TwitterStuff.hashtags", tpp.hashtagPatternString()); addAvail("TwitterStuff.retweets", tpp.retweetPatternString()); addAvail("TwitterStuff.username", tpp.usernamePatternString()); addAvail("EdgePunctuation",EdgePunctuationPatternProvider.edgePuncPattern()); this.counts = new TObjectLongHashMap<String>(); }
public StatsWordMatch() { this.available = new HashMap<String,Pattern>(); addAvail(new EmoticonPatternProvider()); addAvail(new URLPatternProvider()); addAvail(new TimePatternProvider()); addAvail(new PunctuationPatternProvider()); TwitterStuffPatternProvider tpp = new TwitterStuffPatternProvider(); addAvail("TwitterStuff.hashtags", tpp.hashtagPatternString()); addAvail("TwitterStuff.retweets", tpp.retweetPatternString()); addAvail("TwitterStuff.username", tpp.usernamePatternString()); addAvail("EdgePunctuation",EdgePunctuationPatternProvider.edgePuncPattern()); this.counts = new TObjectLongHashMap<String>(); }