Records the fact that a pid has become runnable. This data will
eventually get used to derive each thread's timeSlices array.
14053
function(ts, pid, comm, prio, fromPid) {
      // The the pids that get passed in to this function are Linux kernel
      // pids, which identify threads.  The rest of trace-viewer refers to
      // these as tids, so the change of nomenclature happens in the following
      // construction of the wakeup object.
      this.wakeups_.push({ts: ts, tid: pid, fromTid: fromPid});
    }
866849
def enable_thread_logging(exception_callback=None):
    
    global logged_thread_enabled, Thread
    LoggedThread.exception_callback = exception_callback
    Thread = threading.Thread = LoggedThread
    logged_thread_enabled = True
1000963
public function isAlive()
    {
        if ($this->pid < 1) {
            return false;
        }

        $status = null;
        $pid = pcntl_wait($status, WNOHANG);

        switch ($pid) {
            case -1:
                throw new \RuntimeException('pcntl_wait failed.');

            case $this->pid:
                $this->pid = -1;

                return false;

            case 0:
                return true;
        }

        // Other pid exited.
        return true;
    }
255836
static void logCurrentThreadTrace() {
    ThreadTrace trace = getThreadTrace();

    // New threads must call Tracer.initCurrentThreadTrace() before Tracer
    // statistics are gathered. This is a recent change (Jun 2007) that
    // prevents spurious Third Eye messages when an application uses a class in
    // a different package that happens to call Tracer without knowledge of the
    // application authors.
    if (!trace.isInitialized()) {
      logger.log(
          Level.INFO,
          "Tracer log requested for this thread but was not "
              + "initialized using Tracer.initCurrentThreadTrace().",
          new Throwable());
      return;
    }

    if (!trace.isEmpty()) {
      logger.log(Level.INFO, "timers:\n{0}", getCurrentThreadTraceReport());
    }
  }
818110
public void startIfNotRunning() {
        boolean isStorageRunning = daemonExecutor.isProcessRunning(STORAGE_PIDFILE);
        if (isStorageRunning) {
            System.out.println(DISPLAY_NAME + " is already running");
        } else {
            FileUtils.deleteQuietly(STORAGE_PIDFILE.toFile()); // delete dangling STORAGE_PIDFILE, if any
            start();
        }
    }
266476
def thread_started(self):
		
		while self.check_events() is False:
			self._polling_iteration()
			self.stop_event().wait(self.polling_timeout())
54066
public function initialize()
    {
        if ($this->isActive()) {
            throw new RuntimeException('Process is already active');
        }

        $handle = $this->getFileResource();

        if (! @flock($handle, (LOCK_EX | LOCK_NB))) {
            throw new RuntimeException('Could not lock pidfile');
        }

        if (-1 === @fseek($handle, 0)) {
            throw new RuntimeException('Could not seek pidfile cursor');
        }

        if (! @ftruncate($handle, 0)) {
            throw new RuntimeException('Could not truncate pidfile');
        }

        if (! @fwrite($handle, $this->control->info()->getId().PHP_EOL)) {
            throw new RuntimeException('Could not write on pidfile');
        }
    }
1167293
def thread_stopped(self):
		
		tracker = self.tracker_storage()
		if tracker is not None:
			try:
				if self.ready_event().is_set() is True:
					if self.track_stop() is True:
						details = self.event_details(WTrackerEvents.stop)
						tracker.register_stop(self, event_details=details)
				elif self.exception_event().is_set() is False:
					if self.track_termination() is True:
						details = self.event_details(WTrackerEvents.termination)
						tracker.register_termination(self, event_details=details)
			except Exception as e:
				self.thread_tracker_exception(e)
238315
def start_tracing_process(self, pid):
        
        for thread in self.system.get_process(pid).iter_threads():
            self.__start_tracing(thread)
573421
def process_data(self):

        
        self.trigger("process-data", self.received_data)
        self.received_data = ""
        if self.dispatcher:
            self.time = self.dispatcher.time
212554
public boolean isRunning() {
    lock.lock();
    try {
      return process != null && process.isRunning();
    } catch (IllegalThreadStateException e) {
      return true;
    } finally {
      lock.unlock();
    }
  }
695131
def monitor(seconds_frozen, test_interval):
    
    current_thread = threading.current_thread()
    hanging_threads = set()
    old_threads = {}  # Threads found on previous iteration.

    while not current_thread.is_stopped():
        new_threads = get_current_frames()

        # Report died threads.
        for thread_id in old_threads.keys():
            if thread_id not in new_threads and thread_id in hanging_threads:
                log_died_thread(thread_id)

        # Process live threads.
        time.sleep(test_interval/1000.)
        now = time.time()
        then = now - seconds_frozen
        for thread_id, thread_data in new_threads.items():
            # Don't report the monitor thread.
            if thread_id == current_thread.ident:
                continue
            frame = thread_data['frame']
            # If thread is new or it's stack is changed then update time.
            if (thread_id not in old_threads or
                    frame != old_threads[thread_id]['frame']):
                thread_data['time'] = now
                # If the thread was hanging then report awaked thread.
                if thread_id in hanging_threads:
                    hanging_threads.remove(thread_id)
                    log_awaked_thread(thread_id)
            else:
                # If stack is not changed then keep old time.
                last_change_time = old_threads[thread_id]['time']
                thread_data['time'] = last_change_time
                # Check if this is a new hanging thread.
                if (thread_id not in hanging_threads and
                        last_change_time < then):
                    # Gotcha!
                    hanging_threads.add(thread_id)
                    # Report the hanged thread.
                    log_hanged_thread(thread_id, frame)
        old_threads = new_threads
743485
public function isRunning($pid)
    {
        $lastLine = exec(sprintf('tasklist /fi "PID eq %d" /nh /fo csv 2>nul:', $pid));
        $record = str_getcsv($lastLine);
        return isset($record[1]) && intval($record[1]) === $pid;
    }
373712
protected final void synchronizedRedraw() {
    Runnable pr = new Runnable() {
      @Override
      public void run() {
        if(VisualizationPlot.this.pendingRedraw == this) {
          VisualizationPlot.this.pendingRedraw = null;
          VisualizationPlot.this.redraw();
        }
      }
    };
    pendingRedraw = pr;
    scheduleUpdate(pr);
  }
390360
static void initCurrentThreadTrace() {
    ThreadTrace events = getThreadTrace();
    if (!events.isEmpty()) {
      logger.log(Level.WARNING,
                 "Non-empty timer log:\n" + events,
                 new Throwable());
      clearThreadTrace();

      // Grab a new thread trace if we find a previous non-empty ThreadTrace.
      events = getThreadTrace();
    }

    // Mark the thread trace as initialized.
    events.init();
  }
598732
void recordIterationStarted(AbstractTimer timer) {
        this.iterationId.incrementAndGet();
        this.currentIterationStartTime.set(timer.getElapsed());
        this.lastIterationError.set(false);
    }
1050261
def _StatusUpdateThreadMain(self):
    """"""
    while self._status_update_active:
      # Make a local copy of the PIDs in case the dict is changed by
      # the main thread.
      for pid in list(self._process_information_per_pid.keys()):
        self._CheckStatusWorkerProcess(pid)

      self._UpdateForemanProcessStatus()

      tasks_status = self._task_manager.GetStatusInformation()
      if self._task_queue_profiler:
        self._task_queue_profiler.Sample(tasks_status)

      self._processing_status.UpdateTasksStatus(tasks_status)

      if self._status_update_callback:
        self._status_update_callback(self._processing_status)

      time.sleep(self._STATUS_UPDATE_INTERVAL)