/** * Aggregates other class loading object info this object. * * @param other * Object to aggregate data from. */ @Override public void aggregate(ThreadInformationData other) { count += other.count; minDaemonThreadCount = Math.min(other.getMinDaemonThreadCount(), minDaemonThreadCount); minPeakThreadCount = Math.min(other.getMinPeakThreadCount(), minPeakThreadCount); minThreadCount = Math.min(other.getMinThreadCount(), minThreadCount); minTotalStartedThreadCount = Math.min(other.getMinTotalStartedThreadCount(), minTotalStartedThreadCount); maxDaemonThreadCount = Math.max(other.getMaxDaemonThreadCount(), maxDaemonThreadCount); maxPeakThreadCount = Math.max(other.getMaxPeakThreadCount(), maxPeakThreadCount); maxThreadCount = Math.max(other.getMaxThreadCount(), maxThreadCount); maxTotalStartedThreadCount = Math.max(other.getMaxTotalStartedThreadCount(), maxTotalStartedThreadCount); totalDaemonThreadCount += other.getTotalDaemonThreadCount(); totalPeakThreadCount += other.getTotalPeakThreadCount(); totalThreadCount += other.getTotalThreadCount(); totalTotalStartedThreadCount += other.getTotalTotalStartedThreadCount(); }
/** * Updates the lower plot with the given input data. * * @param threadData * the input data. */ private void addLowerPlotData(List<ThreadInformationData> threadData) { for (ThreadInformationData data : threadData) { float daemonThreadAverage = ((float) data.getTotalDaemonThreadCount()) / data.getCount(); daemonThreads.add(data.getTimeStamp().getTime(), daemonThreadAverage, data.getMinDaemonThreadCount(), data.getMaxDaemonThreadCount(), false); } daemonThreads.fireSeriesChanged(); }
@Test void daemonThreadCountIsCalculated() { when(this.threadBean.getDaemonThreadCount()).thenReturn(10).thenReturn(9).thenReturn(11).thenReturn(10); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); ThreadInformationData collector = (ThreadInformationData) this.cut.get(); assertThat(collector.getMinDaemonThreadCount(), is(9)); assertThat(collector.getMaxDaemonThreadCount(), is(11)); assertThat(collector.getTotalDaemonThreadCount(), is(40)); }
assertThat(threadInformationData.getMinDaemonThreadCount(), is(5)); assertThat(threadInformationData.getMaxDaemonThreadCount(), is(6));
assertThat(threadInformationData.getMinDaemonThreadCount(), is(Integer.MAX_VALUE)); assertThat(threadInformationData.getMaxDaemonThreadCount(), is(0));
this.threadInformationData.addTotalStartedThreadCount(totalStartedThreadCount); if (daemonThreadCount < this.threadInformationData.getMinDaemonThreadCount()) { this.threadInformationData.setMinDaemonThreadCount(daemonThreadCount); } else if (daemonThreadCount > this.threadInformationData.getMaxDaemonThreadCount()) {
/** * {@inheritDoc} */ @Override public SystemSensorData get() { ThreadInformationData newThreadInformationData = new ThreadInformationData(); newThreadInformationData.setPlatformIdent(this.threadInformationData.getPlatformIdent()); newThreadInformationData.setSensorTypeIdent(this.threadInformationData.getSensorTypeIdent()); newThreadInformationData.setCount(this.threadInformationData.getCount()); newThreadInformationData.setTotalDaemonThreadCount(this.threadInformationData.getTotalDaemonThreadCount()); newThreadInformationData.setMinDaemonThreadCount(this.threadInformationData.getMinDaemonThreadCount()); newThreadInformationData.setMaxDaemonThreadCount(this.threadInformationData.getMaxDaemonThreadCount()); newThreadInformationData.setTotalPeakThreadCount(this.threadInformationData.getTotalPeakThreadCount()); newThreadInformationData.setMinPeakThreadCount(this.threadInformationData.getMinPeakThreadCount()); newThreadInformationData.setMaxPeakThreadCount(this.threadInformationData.getMaxPeakThreadCount()); newThreadInformationData.setTotalThreadCount(this.threadInformationData.getTotalThreadCount()); newThreadInformationData.setMinThreadCount(this.threadInformationData.getMinThreadCount()); newThreadInformationData.setMaxThreadCount(this.threadInformationData.getMaxThreadCount()); newThreadInformationData.setTotalTotalStartedThreadCount(this.threadInformationData.getTotalTotalStartedThreadCount()); newThreadInformationData.setMinTotalStartedThreadCount(this.threadInformationData.getMinTotalStartedThreadCount()); newThreadInformationData.setMaxTotalStartedThreadCount(this.threadInformationData.getMaxTotalStartedThreadCount()); newThreadInformationData.setTimeStamp(this.threadInformationData.getTimeStamp()); return newThreadInformationData; }