Pseudo-randomly advances and records the given probe value for the given thread.
771264
static final int advanceProbe(int probe) {
    probe ^= probe << 13; // xorshift
    probe ^= probe >>> 17;
    probe ^= probe << 5;
    setThreadLocalRandomProbe(probe);
    return probe;
  }
1128787
def probe(cls, resource, enable, disable, test, host, interval,
              http_method, http_response, threshold, timeout, url, window):
        
        params = {
            'host': host,
            'interval': interval,
            'method': http_method,
            'response': http_response,
            'threshold': threshold,
            'timeout': timeout,
            'url': url,
            'window': window
        }
        if enable:
            params['enable'] = True
        elif disable:
            params['enable'] = False
        if test:
            result = cls.call(
                'hosting.rproxy.probe.test', cls.usable_id(resource), params)
        else:
            result = cls.call(
                'hosting.rproxy.probe.update', cls.usable_id(resource), params)
            cls.display_progress(result)
        return result
1315300
private void setNextSamplePosition(long position)
    {
        tryAgain: while (true)
        {
            position += minIndexInterval;
            long test = indexIntervalMatches++;
            for (int start : startPoints)
                if ((test - start) % BASE_SAMPLING_LEVEL == 0)
                    continue tryAgain;

            nextSamplePosition = position;
            return;
        }
    }
600921
public boolean notifyProgress(int value, int maximum) {

    boolean result = true;

    for (ProgressMonitor monitor : this.monitors) {
      if (!monitor.notifyProgress(value, maximum)) {
        result = false;
      }
    }

    return result;

  }
377767
def probe_sync(self):
        """"""

        done = threading.Event()
        result = {}

        def probe_done(adapter_id, status, reason):
            result['success'] = status
            result['failure_reason'] = reason
            done.set()

        self.probe_async(probe_done)
        done.wait()

        return result
932070
def watch(watch_value, &block)
      new_thread = Thread.new do
        prev_value = (self.read == GPIO_HIGH ? GPIO_LOW : GPIO_HIGH)

        loop do
          current_value = self.read
          flip = (prev_value != current_value)

          if current_value == watch_value && flip
            self.instance_exec &block
          end

          prev_value = current_value

          sleep WATCH_POLLING_SEC
        end
      end

      new_thread.abort_on_exception = true
      new_thread
    end
626805
private void probe() {
    // First get a sorted list of discovery service nodes that are not present in the SWIM members.
    // This is necessary to ensure we attempt to probe all nodes that are provided by the discovery provider.
    List<SwimMember> probeMembers = Lists.newArrayList(discoveryService.getNodes().stream()
        .map(node -> new SwimMember(MemberId.from(node.id().id()), node.address()))
        .filter(member -> !members.containsKey(member.id()))
        .filter(member -> !member.id().equals(localMember.id()))
        .sorted(Comparator.comparing(Member::id))
        .collect(Collectors.toList()));

    // Then add the randomly sorted list of SWIM members.
    probeMembers.addAll(randomMembers);

    // If there are members to probe, select the next member to probe using a counter for round robin probes.
    if (!probeMembers.isEmpty()) {
      SwimMember probeMember = probeMembers.get(Math.abs(probeCounter.incrementAndGet() % probeMembers.size()));
      probe(probeMember.copy());
    }
  }
214022
def rsl_push_many_readings(self, value, count, stream_id):
        """"""

        #FIXME: Fix this with timestamp from clock manager task

        for i in range(1, count+1):
            err = self.sensor_log.push(stream_id, 0, value)
            if err != Error.NO_ERROR:
                return [err, i]

        return [Error.NO_ERROR, count]
712374
def watch_thread(self):
        ''''''
        from mp_settings import MPSetting
        while True:
            setting = self.child_pipe.recv()
            if not isinstance(setting, MPSetting):
                break
            try:
                self.settings.set(setting.name, setting.value)
            except Exception:
                print("Unable to set %s to %s" % (setting.name, setting.value))
720580
public void update(long value, long timestamp) {
        rescaleIfNeeded();
        lockForRegularUsage();
        try {
            final double itemWeight = weight(timestamp - startTime);
            final WeightedSample sample = new WeightedSample(value, itemWeight);
            final double priority = itemWeight / ThreadLocalRandom.current().nextDouble();

            final long newCount = count.incrementAndGet();
            if (newCount <= size) {
                values.put(priority, sample);
            } else {
                Double first = values.firstKey();
                if (first < priority && values.putIfAbsent(priority, sample) == null) {
                    // ensure we always remove an item
                    while (values.remove(first) == null) {
                        first = values.firstKey();
                    }
                }
            }
        } finally {
            unlockForRegularUsage();
        }
    }
831774
private void probeChannel() {
    if (isStopped()) return;

    try {
      if (selector.selectNow() > 0) {
        final Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();

        while (iterator.hasNext()) {
          final SelectionKey key = iterator.next();
          iterator.remove();

          if (key.isValid()) {
            if (key.isAcceptable()) {
              accept(key);
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      logger().log("Failed to accept client channel for '" + name + "' because: " + e.getMessage(), e);
    }
  }
1183443
public void record(long n) {
    values[Integer.remainderUnsigned(pos++, size)] = n;
    if (curSize < size) {
      ++curSize;
    }
  }
530874
private void probe(ImmutableMember member) {
    LOGGER.trace("{} - Probing {}", localMember.id(), member);
    bootstrapService.getMessagingService().sendAndReceive(
        member.address(), MEMBERSHIP_PROBE, SERIALIZER.encode(Pair.of(localMember.copy(), member)), false, config.getProbeTimeout())
        .whenCompleteAsync((response, error) -> {
          if (error == null) {
            updateState(SERIALIZER.decode(response));
          } else {
            LOGGER.debug("{} - Failed to probe {}", this.localMember.id(), member, error);
            // Verify that the local member term has not changed and request probes from peers.
            SwimMember swimMember = members.get(member.id());
            if (swimMember != null && swimMember.getIncarnationNumber() == member.incarnationNumber()) {
              requestProbes(swimMember.copy());
            }
          }
        }, swimScheduler);
  }
1365660
private void synchronizedRecordResult(CircuitBreakerResult result) {
        synchronized (this) {
            switch (state.get()) {
                case CLOSED:
                    rollingWindow.record(result);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Recording result {0} in closed state: {1}", result, rollingWindow);
                    }
                    if (rollingWindow.isOverThreshold()) {
                        stateOpen();
                    }
                    break;
                case HALF_OPEN:
                    if (result == CircuitBreakerResult.FAILURE) {
                        stateOpen();
                    } else {
                        halfOpenRunningExecutions--;
                        halfOpenSuccessfulExecutions++;
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Recording result {0} in half-open state. Running executions: {1}, Current results: ({2}/{3})",
                                     result, halfOpenRunningExecutions, halfOpenSuccessfulExecutions, policy.getSuccessThreshold());
                        }
                        if (halfOpenSuccessfulExecutions >= policy.getSuccessThreshold()) {
                            stateClosed();
                        }
                    }
                    break;
                case OPEN:
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Recording result {0} in open state", result);
                    }
                    // Nothing else to do
                    break;
            }
        }
    }
294267
def push_thread_local_value(name, value) #:nodoc:
      save_val = thread_local_value(name)
      set_thread_local_value(name, value)
      begin
        yield
      ensure
        set_thread_local_value(name, save_val)
      end
    end
1172776
function(eventName, cpuNumber, pid,
                            ts, eventBase) {
      var event = syncTimelineRE.exec(eventBase.details);
      if (!event)
        return false;

      var thread = this.importer.getOrCreatePseudoThread(event[1]);

      if (thread.lastActiveTs !== undefined) {
        var duration = ts - thread.lastActiveTs;
        var value = thread.lastActiveValue;
        if (value == undefined)
          value = ' ';
        var slice = new tr.model.Slice(
            '', value,
            ColorScheme.getColorIdForGeneralPurposeString(value),
            thread.lastActiveTs, {},
            duration);
        thread.thread.sliceGroup.pushSlice(slice);
      }
      thread.lastActiveTs = ts;
      thread.lastActiveValue = event[2];
      return true;
    }
64342
def update(self, value):
    """"""
    super(UniformSample, self).update(value)

    self.count += 1
    c = self.count
    if c < len(self.sample):
      self.sample[c-1] = value
    else:
      r = random.randint(0, c)
      if r < len(self.sample):
        self.sample[r] = value