/** * Returns the current NanoTime or, if clock stats are disabled, zero. * @since 5.0 */ public static final long getStatTimeNoCheck() { return NanoTimer.getTime(); } ////////////////////// Instance Methods //////////////////////
/** * Returns the current NanoTime or, if clock stats are disabled, zero. * @since 5.0 */ public static long getStatTime() { return enableClockStats ? NanoTimer.getTime() : 0; }
/** * Compute and return the time in nanoseconds since the last reset or * construction of this Timer, but does not reset this timer. * * @return time in nanoseconds since construction or last reset. */ public long getTimeSinceReset() { return getTime() - this.lastResetTime; }
/** * Returns the current NanoTime or, if clock stats are disabled, zero. * * @return long 0 if time stats disabled or the current time in nano secounds. */ public long getStatTime() { return this.enableClockStats ? NanoTimer.getTime() : 0; }
/** * @return the timestamp that marks the start of the UseCase12 Update */ public long startUseCase12Update() { return NanoTimer.getTime(); } /**
/** * @return the timestamp that marks the start of the gateway queue drain */ public long startGatewayQueueDrain() { return NanoTimer.getTime(); } /**
/** * @return the timestamp that marks the start of the query */ public long startQuery() { return NanoTimer.getTime(); } /**
/** * @return the timestamp that marks the start of the locks */ public long startLock() { return NanoTimer.getTime(); } /**
/** * Compute and return the time in nanoseconds since the last reset or * construction of this timer, and reset the timer to the current * {@link #getTime}. * * @return time in nanoseconds since construction or last reset. */ public long reset() { long save = this.lastResetTime; this.lastResetTime = getTime(); return this.lastResetTime - save; }
/** * Returns the current NanoTime or, if clock stats are disabled, zero. * @since 5.0 */ public static long getStatTime() { return enableClockStats? NanoTimer.getTime() : 0; }
/** * @return the timestamp that marks the start of the operation */ public long startNetsearch() { stats.incInt(netsearchesInProgressId, 1); return NanoTimer.getTime(); // don't use getStatTime so always enabled } /**
/** * Start the CQ Query Execution time. */ public long startCqQueryExecution() { this._stats.incInt(_cqQueryExecutionInProgressId, 1); return NanoTimer.getTime(); }
/** * @return the timestamp that marks the start of the operation */ public long startNetsearch() { stats.incInt(netsearchesInProgressId, 1); return NanoTimer.getTime(); // don't use getStatTime so always enabled } /**
/** * @param start the timestamp taken when the put comparisons started */ public void endPutComparison(long start, boolean isMainWorkload, HistogramStats histogram) { long elapsed = NanoTimer.getTime() - start; incPutComparisons(1, isMainWorkload); incPutComparisonTime(elapsed, isMainWorkload); incHistogram(histogram, elapsed); }
public void rebalancingOrRecoveryFinished(Region region) { long end = NanoTimer.getTime(); long elapsed = end - start; TaskSyncBlackboard.getInstance().getSharedMap() .put(TaskSyncBlackboard.RECOVERY_KEY, Long.valueOf(elapsed)); Log.getLogWriter().info("Recovered at " + end + ", in " + elapsed + " ns"); }
/** * @param start the timestamp taken when the putAll operation started */ public void endPutAll(long start, int mapSize) { long ts = NanoTimer.getTime(); statistics().incLong(PUTALL_ENTRIES, mapSize); long elapsed = ts-start; statistics().incLong(PUTALL_TIME, elapsed); } }
/** * @param start the timestamp taken when the unlocks started */ public void endUnlock(long start) { long ts = NanoTimer.getTime(); statistics().incInt(UNLOCKS, 1); long elapsed = ts-start; statistics().incLong(UNLOCK_TIME, elapsed); } }
public void testNotificationSampleFrequencyDefault() { final int sampleFrequency = 1; StatMonitorHandler handler = new StatMonitorHandler(this.log); TestStatisticsMonitor monitor = new TestStatisticsMonitor(); handler.addMonitor(monitor); final int sampleCount = 100; for (int i = 0; i < sampleCount; i++) { handler.sampled(NanoTimer.getTime(), Collections.<ResourceInstance>emptyList()); waitForNotificationCount(monitor, 1+i, 2*1000, 10, false); } assertEquals(sampleCount/sampleFrequency, monitor.getNotificationCount()); }
public void testNotificationSampleTimeMillis() { final long currentTime = System.currentTimeMillis(); StatMonitorHandler handler = new StatMonitorHandler(this.log); TestStatisticsMonitor monitor = new TestStatisticsMonitor(); handler.addMonitor(monitor); long nanoTimeStamp = NanoTimer.getTime(); handler.sampled(nanoTimeStamp, Collections.<ResourceInstance>emptyList()); waitForNotificationCount(monitor, 1, 2*1000, 10, false); assertTrue(monitor.getTimeStamp() != nanoTimeStamp); assertTrue(monitor.getTimeStamp() >= currentTime); }
public void testAddNewMonitor() throws Exception { StatMonitorHandler handler = new StatMonitorHandler(this.log); assertTrue(handler.getMonitorsSnapshot().isEmpty()); TestStatisticsMonitor monitor = new TestStatisticsMonitor(); assertTrue(handler.addMonitor(monitor)); assertFalse(handler.getMonitorsSnapshot().isEmpty()); assertTrue(handler.getMonitorsSnapshot().contains(monitor)); handler.sampled(NanoTimer.getTime(), Collections.<ResourceInstance>emptyList()); waitForNotificationCount(monitor, 1, 2*1000, 10, false); assertEquals(1, monitor.getNotificationCount()); }