+ }, currentTimerDelay, TimeUnit.MILLISECONDS);
+ }
+ }
+
+ private void calculateTimerDelay() {
+ long averageStatisticsGatheringTime = timeCounter.getAverageTimeBetweenMarks();
+ int numberOfDevices = contexts.size();
+ if ((averageStatisticsGatheringTime * numberOfDevices) > currentTimerDelay) {
+ currentTimerDelay *= 2;
+ if (currentTimerDelay > maximumTimerDelay) {
+ currentTimerDelay = maximumTimerDelay;
+ }
+ } else {
+ if (currentTimerDelay > basicTimerDelay) {
+ currentTimerDelay /= 2;
+ }