/** * Some checks for the getFirstMillisecond(TimeZone) method. */ public void testGetFirstMillisecondWithTimeZone() { Millisecond m = new Millisecond(500, 50, 59, 15, 1, 4, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); assertEquals(-623289609500L, m.getFirstMillisecond(zone)); // try null calendar boolean pass = false; try { m.getFirstMillisecond((TimeZone) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the getFirstMillisecond(TimeZone) method. */ public void testGetFirstMillisecondWithCalendar() { Millisecond m = new Millisecond(500, 55, 40, 2, 15, 4, 2000); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); assertEquals(955762855500L, m.getFirstMillisecond(calendar)); // try null calendar boolean pass = false; try { m.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the getLastMillisecond(TimeZone) method. */ public void testGetLastMillisecondWithTimeZone() { Millisecond m = new Millisecond(750, 55, 1, 2, 7, 7, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); assertEquals(-614962684250L, m.getLastMillisecond(zone)); // try null calendar boolean pass = false; try { m.getLastMillisecond((TimeZone) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the getLastMillisecond(TimeZone) method. */ public void testGetLastMillisecondWithCalendar() { Millisecond m = new Millisecond(250, 50, 45, 21, 21, 4, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); assertEquals(987885950250L, m.getLastMillisecond(calendar)); // try null calendar boolean pass = false; try { m.getLastMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
public void update(WorkerStat ws){ cpuSet.getSeries(CPU_USAGE).add(new Millisecond(), ws.cpuUsage);//FIXME memSet.getSeries(MEM_USED).add(new Millisecond(), ws.memUsed);//FIXME netSet.getSeries(BW_USAGE).add(new Millisecond(), ws.bwUsageUS/1E6);//FIXME subpubCountSet.setValue(ws.localSubscriberCount, LOCAL_SUB_COUNT, SUB_PUB_COUNT_CATEGORY); subpubCountSet.setValue(ws.remoteSubscriberCount, REMOTE_SUB_COUNT, SUB_PUB_COUNT_CATEGORY); subpubCountSet.setValue(ws.localPublisherCount, LOCAL_PUB_COUNT, SUB_PUB_COUNT_CATEGORY); subpubCountSet.setValue(ws.remotePublisherCount, REMOTE_PUB_COUNT, SUB_PUB_COUNT_CATEGORY); oprCountSet.setValue(ws.filterCount, FILTER_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.filterCompCount, FILTER_COMP_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.patternCount, PATTERN_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.patternCompCount, PATTERN_COMP_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.joinCount, JOIN_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.joinCompCount, JOIN_COMP_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.rootCount, ROOT_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.rawStatsCount, RAW_STAT_COUNT, OPR_COUNT_CATEGORY); timeSet.setValue(ws.filterCondProcTimeUS, FILTER_COND_PROC_TIME, TIME_CATEGORY); timeSet.setValue(ws.joinCondProcTimeUS, JOIN_COND_PROC_TIME, TIME_CATEGORY); timeSet.setValue(ws.sendBaseTimeUS, SEND_BASE_TIME, TIME_CATEGORY); timeSet.setValue(ws.sendByteRateUS, SEND_BYTE_RATE, TIME_CATEGORY); }
/** * Record the given {@link NetworkSnapshot} delta, updating * {@link TimeSeries} and summary statistics. * * @param time Timestamp when delta was observed. * @param deltaMillis Time duration covered by delta, in milliseconds. */ public void recordDelta(Millisecond time, long deltaMillis, NetworkSnapshot.Entry delta) { final long rxBytesPerSecond = (delta.rxBytes * 1000) / deltaMillis; final long txBytesPerSecond = (delta.txBytes * 1000) / deltaMillis; // record values under correct series if (isTotal()) { mRxTotalSeries.addOrUpdate(time, rxBytesPerSecond); mTxTotalSeries.addOrUpdate(time, -txBytesPerSecond); } else { mRxDetailDataset.addValue(rxBytesPerSecond, time, label); mTxDetailDataset.addValue(-txBytesPerSecond, time, label); } rxBytes += delta.rxBytes; rxPackets += delta.rxPackets; txBytes += delta.txBytes; txPackets += delta.txPackets; }
/** * Some checks for the getFirstMillisecond(TimeZone) method. */ public void testGetFirstMillisecondWithTimeZone() { Millisecond m = new Millisecond(500, 50, 59, 15, 1, 4, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-623289609500L, m.getFirstMillisecond(c)); // try null calendar boolean pass = false; try { m.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the getFirstMillisecond(TimeZone) method. */ public void testGetFirstMillisecondWithCalendar() { Millisecond m = new Millisecond(500, 55, 40, 2, 15, 4, 2000); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(955766455500L, m.getFirstMillisecond(calendar)); // try null calendar boolean pass = false; try { m.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the getLastMillisecond(TimeZone) method. */ public void testGetLastMillisecondWithTimeZone() { Millisecond m = new Millisecond(750, 55, 1, 2, 7, 7, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-614962684250L, m.getLastMillisecond(c)); // try null calendar boolean pass = false; try { m.getLastMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the getLastMillisecond(TimeZone) method. */ public void testGetLastMillisecondWithCalendar() { Millisecond m = new Millisecond(250, 50, 45, 21, 21, 4, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(987889550250L, m.getLastMillisecond(calendar)); // try null calendar boolean pass = false; try { m.getLastMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
void updateAnnotation(RasterDataNode raster) { removeAnnotation(); final AbstractTimeSeries timeSeries = getTimeSeries(); TimeCoding timeCoding = timeSeries.getRasterTimeMap().get(raster); if (timeCoding != null) { final ProductData.UTC startTime = timeCoding.getStartTime(); final Millisecond timePeriod = new Millisecond(startTime.getAsDate(), ProductData.UTC.UTC_TIME_ZONE, Locale.getDefault()); double millisecond = timePeriod.getFirstMillisecond(); Range valueRange = null; for (int i = 0; i < timeSeriesPlot.getRangeAxisCount(); i++) { valueRange = Range.combine(valueRange, timeSeriesPlot.getRangeAxis(i).getRange()); } if (valueRange != null) { XYAnnotation annotation = new XYLineAnnotation(millisecond, valueRange.getLowerBound(), millisecond, valueRange.getUpperBound()); timeSeriesPlot.addAnnotation(annotation, true); } } }
private TimeSeries computeSingleTimeSeries(final List<Band> bandList, int pixelX, int pixelY, int currentLevel, String positionName) { final Band firstBand = bandList.get(0); final String firstBandName = firstBand.getName(); final int lastUnderscore = firstBandName.lastIndexOf("_"); final String suffix = positionName.isEmpty()?positionName: "_" + positionName; final String timeSeriesName = firstBandName.substring(0, lastUnderscore); final TimeSeries timeSeries = new TimeSeries(timeSeriesName + suffix); for (Band band : bandList) { final TimeCoding timeCoding = this.timeSeries.getRasterTimeMap().get(band); if (timeCoding != null) { final ProductData.UTC startTime = timeCoding.getStartTime(); final Millisecond timePeriod = new Millisecond(startTime.getAsDate(), ProductData.UTC.UTC_TIME_ZONE, Locale.getDefault()); final double value = getValue(band, pixelX, pixelY, currentLevel); timeSeries.add(new TimeSeriesDataItem(timePeriod, value)); } } return timeSeries; }
/** * Returns data with series 0 = current and 1 = baseline. This method assumes there is exactly one * metric in the response data. */ private TimeSeriesCollection createTimeSeries(final TimeOnTimeComparisonResponse data) { final TimeSeries baseline = new TimeSeries(BASELINE_LABEL); final TimeSeries current = new TimeSeries(CURRENT_LABEL); for (int i = 0; i < data.getNumRows(); i++) { Row row = data.getRow(i); // Plot the baseline data as an overlay on the corresponding current data point. // long baselineStart = row.getBaselineStart().getMillis(); long currentStart = row.getCurrentStart().getMillis(); Date date = new Date(currentStart); RegularTimePeriod timePeriod = new Millisecond(date); Metric metric = row.getMetrics().get(0); baseline.add(timePeriod, metric.getBaselineValue()); current.add(timePeriod, metric.getCurrentValue()); } final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(current); dataset.addSeries(baseline); return dataset; }
@SuppressWarnings({"unchecked", "rawtypes"}) public void reportValues(Map vars, MarketEvent event) { Millisecond time = new Millisecond(new Date(event.getPhysicalTime())); ArrayList list = new ArrayList(vars.keySet()); Iterator i = list.iterator(); while (i.hasNext()) { ReportVariable var = (ReportVariable) i.next(); Object value = vars.get(var); if (value instanceof Number) { double v = ((Number) value).doubleValue(); if (!Double.isNaN(v)) { reportValue(var.getName(), new TimePeriodValue(time, v)); } } else if (value instanceof Boolean) { reportValue(var.getName(), new TimePeriodValue(time, ((Boolean) value) .booleanValue() ? 1 : 0)); } } }
private XYDataset createDataSet() { TimeSeriesCollection dataSet = new TimeSeriesCollection(TimeZone.getTimeZone("UTC")); TimeSeries s1 = new TimeSeries("Total Capital"); TimeSeries s2 = new TimeSeries("Industry Wallet"); TimeSeries s3 = new TimeSeries("Material Value"); TimeSeries s4 = new TimeSeries("Market Orders Value"); for (IndustryStatsEntry iS : cdb.getIndustryStats()) { s1.add(new Millisecond(iS.getDate()), iS.getTotalCapital()); s2.add(new Millisecond(iS.getDate()), iS.getIndustryWallet()); s3.add(new Millisecond(iS.getDate()), iS.getMaterialValue()); s4.add(new Millisecond(iS.getDate()), iS.getMarketOrdersValue()); } dataSet.addSeries(s1); dataSet.addSeries(s2); dataSet.addSeries(s3); dataSet.addSeries(s4); return dataSet; }
/** * Tests the equals method. */ public void testEquals() { final Day day1 = new Day(29, SerialDate.MARCH, 2002); final Hour hour1 = new Hour(15, day1); final Minute minute1 = new Minute(15, hour1); final Second second1 = new Second(34, minute1); final Millisecond milli1 = new Millisecond(999, second1); final Day day2 = new Day(29, SerialDate.MARCH, 2002); final Hour hour2 = new Hour(15, day2); final Minute minute2 = new Minute(15, hour2); final Second second2 = new Second(34, minute2); final Millisecond milli2 = new Millisecond(999, second2); assertTrue(milli1.equals(milli2)); }
/** * In GMT, the 4.55:59.123pm on 21 Mar 2002 is java.util.Date(1016729759123L). * Use this to check the Second constructor. */ public void testDateConstructor1() { final TimeZone zone = TimeZone.getTimeZone("GMT"); final Millisecond m1 = new Millisecond(new Date(1016729759122L), zone); final Millisecond m2 = new Millisecond(new Date(1016729759123L), zone); assertEquals(122, m1.getMillisecond()); assertEquals(1016729759122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016729759123L, m2.getFirstMillisecond(zone)); }
/** * In Tallinn, the 4.55:59.123pm on 21 Mar 2002 is java.util.Date(1016722559123L). * Use this to check the Second constructor. */ public void testDateConstructor2() { final TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn"); final Millisecond m1 = new Millisecond(new Date(1016722559122L), zone); final Millisecond m2 = new Millisecond(new Date(1016722559123L), zone); assertEquals(122, m1.getMillisecond()); assertEquals(1016722559122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016722559123L, m2.getFirstMillisecond(zone)); }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { final Millisecond m1 = new Millisecond(599, 23, 45, 7, 9, 10, 2007); final Millisecond m2 = new Millisecond(599, 23, 45, 7, 9, 10, 2007); assertTrue(m1.equals(m2)); final int hash1 = m1.hashCode(); final int hash2 = m2.hashCode(); assertEquals(hash1, hash2); }
/** * Tests the equals method. */ public void testEquals() { Day day1 = new Day(29, MonthConstants.MARCH, 2002); Hour hour1 = new Hour(15, day1); Minute minute1 = new Minute(15, hour1); Second second1 = new Second(34, minute1); Millisecond milli1 = new Millisecond(999, second1); Day day2 = new Day(29, MonthConstants.MARCH, 2002); Hour hour2 = new Hour(15, day2); Minute minute2 = new Minute(15, hour2); Second second2 = new Second(34, minute2); Millisecond milli2 = new Millisecond(999, second2); assertTrue(milli1.equals(milli2)); }
/** * In GMT, the 4.55:59.123pm on 21 Mar 2002 is * java.util.Date(1016729759123L). Use this to check the Millisecond * constructor. */ public void testDateConstructor1() { TimeZone zone = TimeZone.getTimeZone("GMT"); Millisecond m1 = new Millisecond(new Date(1016729759122L), zone); Millisecond m2 = new Millisecond(new Date(1016729759123L), zone); assertEquals(122, m1.getMillisecond()); assertEquals(1016729759122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016729759123L, m2.getFirstMillisecond(zone)); }
/** * In Tallinn, the 4.55:59.123pm on 21 Mar 2002 is * java.util.Date(1016722559123L). Use this to check the Millisecond * constructor. */ public void testDateConstructor2() { TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn"); Millisecond m1 = new Millisecond(new Date(1016722559122L), zone); Millisecond m2 = new Millisecond(new Date(1016722559123L), zone); assertEquals(122, m1.getMillisecond()); assertEquals(1016722559122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016722559123L, m2.getFirstMillisecond(zone)); }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { Millisecond m1 = new Millisecond(599, 23, 45, 7, 9, 10, 2007); Millisecond m2 = new Millisecond(599, 23, 45, 7, 9, 10, 2007); assertTrue(m1.equals(m2)); int hash1 = m1.hashCode(); int hash2 = m2.hashCode(); assertEquals(hash1, hash2); }
/** * Some checks for the getFirstMillisecond() method. */ public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006); assertEquals(1143902595500L, m.getFirstMillisecond()); Locale.setDefault(saved); }
/** * Some checks for the getLastMillisecond() method. */ public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970); assertEquals(61750L, m.getLastMillisecond()); Locale.setDefault(saved); }
/** * Some checks for the getStart() method. */ public void testGetStart() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 555); Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getStart()); Locale.setDefault(saved); }
/** * Some checks for the getEnd() method. */ public void testGetEnd() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 555); Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getEnd()); Locale.setDefault(saved); }
/** * A basic check for the testPreviousStandardDate() method when the * tick unit is 1 millisecond. */ @Test public void testPreviousStandardDateMillisecondA() { MyDateAxis axis = new MyDateAxis("Millisecond"); Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007); Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007); Date d0 = new Date(m0.getFirstMillisecond()); Date end = new Date(m1.getLastMillisecond()); DateTickUnit unit = new DateTickUnit(DateTickUnit.MILLISECOND, 1); axis.setTickUnit(unit); // START: check d0 axis.setTickMarkPosition(DateTickMarkPosition.START); axis.setRange(d0, end); Date psd = axis.previousStandardDate(d0, unit); Date nsd = unit.addToDate(psd); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // MIDDLE: check d0 axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // END: check d0 axis.setTickMarkPosition(DateTickMarkPosition.END); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); }
/** * A basic check for the testPreviousStandardDate() method when the * tick unit is 10 milliseconds (just for the sake of having a multiple). */ @Test public void testPreviousStandardDateMillisecondB() { MyDateAxis axis = new MyDateAxis("Millisecond"); Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007); Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007); Date d0 = new Date(m0.getFirstMillisecond()); Date end = new Date(m1.getLastMillisecond()); DateTickUnit unit = new DateTickUnit(DateTickUnit.MILLISECOND, 10); axis.setTickUnit(unit); // START: check d0 axis.setTickMarkPosition(DateTickMarkPosition.START); axis.setRange(d0, end); Date psd = axis.previousStandardDate(d0, unit); Date nsd = unit.addToDate(psd); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // MIDDLE: check d0 axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // END: check d0 axis.setTickMarkPosition(DateTickMarkPosition.END); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); }
/** * A basic check for the testPreviousStandardDate() method when the * tick unit is 1 millisecond. */ @Test public void testPreviousStandardDateMillisecondA() { MyDateAxis axis = new MyDateAxis("Millisecond"); Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007); Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007); Date d0 = new Date(m0.getFirstMillisecond()); Date end = new Date(m1.getLastMillisecond()); DateTickUnit unit = new DateTickUnit(DateTickUnitType.MILLISECOND, 1); axis.setTickUnit(unit); // START: check d0 axis.setTickMarkPosition(DateTickMarkPosition.START); axis.setRange(d0, end); Date psd = axis.previousStandardDate(d0, unit); Date nsd = unit.addToDate(psd, TimeZone.getDefault()); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // MIDDLE: check d0 axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd, TimeZone.getDefault()); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // END: check d0 axis.setTickMarkPosition(DateTickMarkPosition.END); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd, TimeZone.getDefault()); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); }
/** * A basic check for the testPreviousStandardDate() method when the * tick unit is 10 milliseconds (just for the sake of having a multiple). */ @Test public void testPreviousStandardDateMillisecondB() { MyDateAxis axis = new MyDateAxis("Millisecond"); Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007); Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007); Date d0 = new Date(m0.getFirstMillisecond()); Date end = new Date(m1.getLastMillisecond()); DateTickUnit unit = new DateTickUnit(DateTickUnitType.MILLISECOND, 10); axis.setTickUnit(unit); // START: check d0 axis.setTickMarkPosition(DateTickMarkPosition.START); axis.setRange(d0, end); Date psd = axis.previousStandardDate(d0, unit); Date nsd = unit.addToDate(psd, TimeZone.getDefault()); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // MIDDLE: check d0 axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd, TimeZone.getDefault()); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); // END: check d0 axis.setTickMarkPosition(DateTickMarkPosition.END); axis.setRange(d0, end); psd = axis.previousStandardDate(d0, unit); nsd = unit.addToDate(psd, TimeZone.getDefault()); assertTrue(psd.getTime() < d0.getTime()); assertTrue(nsd.getTime() >= d0.getTime()); }
public void update() { long time = cpu.cycles / 2; if (time > lastUpdate) { lastUpdate = time; timeSeries.add(new Millisecond(new Date(time)), dataSource.getValue()); } else { // System.out.println("IGNORING TIME " + time); } }
public void update(WorkerStat ws){ cpuSet.getSeries(CPU_USAGE).add(new Millisecond(), ws.cpuUsage);//FIXME cpuSet.getSeries(CPU_FREE).add(new Millisecond(), 1.0-ws.cpuUsage);//FIXME memSet.getSeries(MEM_USED).add(new Millisecond(), ws.memUsed/1E6);//FIXME memSet.getSeries(MEM_FREE).add(new Millisecond(), ws.memFree/1E6);//FIXME netSet.getSeries(BW_USAGE).add(new Millisecond(), ws.bwUsageUS/1E6);//FIXME netSet.getSeries(BW_FREE).add(new Millisecond(), 1.0-ws.bwUsageUS/1E6);//FIXME subpubCountSet.setValue(ws.localSubscriberCount, LOCAL_SUB_COUNT, SUB_PUB_COUNT_CATEGORY); subpubCountSet.setValue(ws.remoteSubscriberCount, REMOTE_SUB_COUNT, SUB_PUB_COUNT_CATEGORY); subpubCountSet.setValue(ws.localPublisherCount, LOCAL_PUB_COUNT, SUB_PUB_COUNT_CATEGORY); subpubCountSet.setValue(ws.remotePublisherCount, REMOTE_PUB_COUNT, SUB_PUB_COUNT_CATEGORY); oprCountSet.setValue(ws.filterCount, FILTER_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.filterDelayedCount, FILTER_DELAYED_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.patternCount, PATTERN_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.patternDelayedCount, PATTERN_DELAYED_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.joinCount, JOIN_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.joinDelayedCount, JOIN_DELAYED_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.rootCount, ROOT_COUNT, OPR_COUNT_CATEGORY); oprCountSet.setValue(ws.getRawStreamSampleCount(), RAW_STAT_COUNT, OPR_COUNT_CATEGORY); timeSet.setValue(ws.filterCondProcTimeUS, FILTER_COND_PROC_TIME, TIME_CATEGORY); timeSet.setValue(ws.joinCondProcTimeUS, JOIN_COND_PROC_TIME, TIME_CATEGORY); timeSet.setValue(ws.sendBaseTimeUS, SEND_BASE_TIME, TIME_CATEGORY); timeSet.setValue(ws.sendByteRateUS, SEND_BYTE_RATE, TIME_CATEGORY); }