Grab the stats.

        Infinite loop, should be stopped by calling the stop() method
332644
def run(self):
        
        for i in self._stats_stream:
            self._stats = i
            time.sleep(0.1)
            if self.stopped():
                break
328736
def _stop(self):
        '''  '''
        duration = time.time() - self.start
        self.result['stop'] = str(datetime.datetime.now())
        self.result['delta'] = int(duration)

        if self.duration_unit == 'minutes':
            duration = round(duration / 60.0, 2)
        else:
            duration = round(duration, 2)

        self.result['stdout'] = "Paused for %s %s" % (duration, self.duration_unit)
1282763
@PreDestroy
    public void stop() {
        logger.info("Stop...");
        lifecycleLock.writeLock().lock();
        try {
            if (!State.STARTED.equals(state)) {
                logger.debug("Ignore stop() command for " + state + " instance");
                return;
            }
            logger.info("Unregister shutdown hook");
            this.shutdownHook.unregisterFromRuntime();

            logger.info("Shutdown collectScheduledExecutor and exportScheduledExecutor...");
            // no need to `shutdown()` and `awaitTermination()` before `shutdownNow()` as we invoke `collectMetrics()` and `exportCollectedMetrics()`
            // `shutdownNow()` can be invoked before `collectMetrics()` and `exportCollectedMetrics()`
            collectScheduledExecutor.shutdownNow();
            exportScheduledExecutor.shutdownNow();

            try {
                logger.info("Collect metrics...");
                collectMetrics();
                logger.info("Export metrics...");
                exportCollectedMetrics();
            } catch (RuntimeException e) {
                logger.warn("Ignore failure collecting and exporting metrics during stop", e);
            }

            // queries and outputwriters can be stopped even if exports threads are running thanks to the lifecycleLock
            logger.info("Stop queries...");
            for (Query query : queries) {
                try {
                    query.stop();
                } catch (Exception e) {
                    logger.warn("Ignore exception stopping query {}", query, e);
                }
            }

            logger.info("Stop output writers...");
            for (OutputWriter outputWriter : outputWriters) {
                try {
                    outputWriter.stop();
                } catch (Exception e) {
                    logger.warn("Ignore exception stopping outputWriters", e);
                }
            }

            state = State.STOPPED;
            logger.info("Set state to {}", state);
        } catch (RuntimeException e) {
            state = State.ERROR;
            if (logger.isDebugEnabled()) {
                // to troubleshoot JMX call errors or equivalent, it may be useful to log and rethrow
                logger.warn("Exception stopping EmbeddedJmxTrans", e);
            }
            throw e;
        } finally {
            lifecycleLock.writeLock().unlock();
        }
        logger.info("Stopped");
    }
764103
public void stop() {
    if (httpHandler != null) {
      httpHandler.shutdown();
    }
    if (server != null) {
      ServerTools.print("Stopping server...");
      server.stop(5);
      isRunning = false;
      ServerTools.print("Server stopped");
    }
  }
243339
def stop(self):
        
        self.child.terminate()
        self._cleanup()
        return self.child.exitcode
258403
def main_loop(self, timeout=None):
        
        if self.trigger_event.wait(timeout):
            try:
                self.func()
            except Exception as e:
                self.logger.warning("Got an exception running {func}: {e}".format(func=self.func, e=str(e)))
            finally:
                self.trigger_event.clear()
361585
def end_timing(self, name, elapsed):
        
        counter = self.get(name, CounterType.Interval)
        self._calculate_stats(counter, elapsed)
        self._update()
1205432
function finalize () {
  stats.stop()
  if (argv.summary === true && rwWorkers > 0) {
    return stats.reportFinal(argv, console.log)
  }
}
1194401
def manage_itstat(self):
        """"""

        # Extract and record iteration stats
        itst = self.iteration_stats()
        self.itstat.append(itst)
        self.display_status(self.fmtstr, itst)
483392
function onStats( error, stat ) {
		if ( error ) {
			return clbk( error );
		}
		m.mem.memUsed = stat.memory / 1000; // KB
		m.mem.utilization = stat.memory / os.totalmem();
		m.cpu = {
			'utilization': stat.cpu / 100
		};
		clbk( null, m );
	}
1091676
def stop(self):
        

        instance_status = Instance.InstanceStatus(status='Terminated')
        xml_content = instance_status.serialize()

        headers = {'Content-Type': 'application/xml'}
        self._client.put(self.resource(), xml_content, headers=headers)
112802
def end(self):
        
        if self.loop:
            self.restart
            return

        self.addstr(2, self.x_grid / 2 - 4, "GAMEOVER", 7)

        if self.hud:
            self.addstr(2, self.x_pad + 13, len(self.grid), 5)
            self.addstr(3, self.x_pad + 13, self.current_gen, 5)

        if self.test:
            exit()
        while self.state == 'stopped':
            key = self.win.getch()
            if key == ord('q'):
                exit()
            if key in [ord('s'), ord('r')]:
                self.restart
337905
def end_output (self, **kwargs):
        """"""
        self.stats.downloaded_bytes = kwargs.get("downloaded_bytes")
        self.stats.num_urls = kwargs.get("num_urls")
        if self.has_part('stats'):
            self.write_stats()
        if self.has_part('outro'):
            self.write_outro(interrupt=kwargs.get("interrupt"))
        self.close_fileoutput()
1219292
public void stop() {
        if (this.isRunning()) {
            long duration = System.nanoTime() - this.lastStarted;
            this.lastStarted = 0l;
            this.stats.add(new Duration(duration));
        }
    }
1223511
public void stop() throws IllegalStateException {
		if (!this.running) {
			throw new IllegalStateException("Can't stop StopWatch: it's not running");
		}
		long lastTime = System.currentTimeMillis() - this.startTimeMillis;
		this.totalTimeMillis += lastTime;
		this.lastTaskInfo = new TaskInfo(this.currentTaskName, lastTime);
		if (this.keepTaskList) {
			this.taskList.add(lastTaskInfo);
		}
		++this.taskCount;
		this.running = false;
		this.currentTaskName = null;
	}
910833
def stats_flush(self):
        
        while True:
            try:
                eventlet.sleep(self.flush_interval)
                if self.debug:
                    print "seen %d stats so far." % self.stats_seen
                    print "current counters: %s" % self.counters
                if self.pickle_proto:
                    payload = self.pickle_payload()
                    if payload:
                        for batch in payload:
                            self.report_stats(batch)
                else:
                    payload = self.plain_payload()
                    if payload:
                        self.report_stats(payload)
            except: # safety net
                self.logger.critical('Encountered error in stats_flush loop')
1365353
def stop(self):
        
        if ( self.dev == None ): return ''
        buf = [REPORT_ID, ord('p'), 0, 0, 0, 0, 0, 0, 0]
        return self.write(buf);