Date dataNewestDate = new Date(0); if (!oldData.isEmpty()) { dataNewestDate = oldData.get(oldData.size() - 1).getTimeStamp(); if (newestDate.before(data.get(data.size() - 1).getTimeStamp())) { newestDate = new Date(data.get(data.size() - 1).getTimeStamp().getTime()); oldData.addAll(rightData); oldToDate = (Date) to.clone(); if (newestDate.before(rightData.get(rightData.size() - 1).getTimeStamp())) { newestDate = new Date(rightData.get(rightData.size() - 1).getTimeStamp().getTime()); oldData.addAll(timerData); oldToDate = (Date) to.clone(); if (newestDate.before(timerData.get(timerData.size() - 1).getTimeStamp())) { newestDate = new Date(timerData.get(timerData.size() - 1).getTimeStamp().getTime());
/** * Updates the upper plot with the given input data. * * @param memoryData * the input data. */ private void addUpperPlotData(List<MemoryInformationData> memoryData) { for (MemoryInformationData data : memoryData) { long usedHeapMemoryAvg = (data.getTotalUsedHeapMemorySize() / data.getCount()) / 1024; heapMemory.add(data.getTimeStamp().getTime(), usedHeapMemoryAvg, data.getMinUsedHeapMemorySize() / 1024.0d, data.getMaxUsedHeapMemorySize() / 1024.0d, false); } heapMemory.fireSeriesChanged(); }
/** * Updates the lower plot with the given input data. * * @param memoryData * the input data. */ private void addLowerPlotData(List<MemoryInformationData> memoryData) { for (MemoryInformationData data : memoryData) { // TODO adjust the fractional part long usedNonHeapMemoryAvg = (data.getTotalUsedNonHeapMemorySize() / data.getCount()) / 1024; nonHeapMemory.add(data.getTimeStamp().getTime(), usedNonHeapMemoryAvg, data.getMinUsedNonHeapMemorySize() / 1024.0d, data.getMaxUsedNonHeapMemorySize() / 1024.0d, false); } nonHeapMemory.fireSeriesChanged(); }
@Test public void noPlatform() throws Exception { when(cachedDataService.getPlatformIdentForId(PLATFORM_ID)).thenReturn(null); long time = RandomUtils.nextLong(); when(data.getPlatformIdent()).thenReturn(PLATFORM_ID); when(data.getTimeStamp()).thenReturn(new Timestamp(time)); when(data.getCount()).thenReturn(1); Collection<Builder> pointBuilderCol = builder.createBuilders(data); assertThat(pointBuilderCol.size(), is(1)); Builder pointBuilder = pointBuilderCol.iterator().next(); assertThat(getMeasurement(pointBuilder), is(Series.MemoryInformation.NAME)); assertThat(getTime(pointBuilder), is(time)); assertThat(getPrecision(pointBuilder), is(TimeUnit.MILLISECONDS)); assertThat(getTags(pointBuilder), hasEntry(Series.TAG_AGENT_ID, String.valueOf(PLATFORM_ID))); assertThat(getTags(pointBuilder), not(hasKey(Series.TAG_AGENT_NAME))); }
when(data.getTimeStamp()).thenReturn(new Timestamp(time)); when(data.getCount()).thenReturn(5); when(data.getTotalFreePhysMemory()).thenReturn(0L);
assertThat(memoryInformationData.getMaxComittedNonHeapMemorySize(), is(0L)); assertThat(memoryInformationData.getTimeStamp().getTime(), is(not(25L)));
assertThat(memoryInformationData.getTotalComittedNonHeapMemorySize(), is(24L)); assertThat(memoryInformationData.getTimeStamp().getTime(), is(25L));
when(data.getTimeStamp()).thenReturn(new Timestamp(time)); when(data.getCount()).thenReturn(5); when(data.getTotalFreePhysMemory()).thenReturn(RandomUtils.nextLong());
newMemoryInformationData.setTotalComittedNonHeapMemorySize(this.memoryInformationData.getTotalComittedNonHeapMemorySize()); newMemoryInformationData.setTimeStamp(this.memoryInformationData.getTimeStamp());