Print the start of timing message to stderr and start the timer.
488563
public void doing(String str) {
    System.err.print(str);
    System.err.print(" ... ");
    System.err.flush();
    start();
  }
922736
def debug(msg):
    '''
    
    '''
    if DEBUG:
        sys.stderr.write("DEBUG: " + msg + "\n")
        sys.stderr.flush()
1125175
def run(self):
        """"""
        start = time.clock()
        it = iter(self.reader)
        if self.args.max_records:
            it = itertools.islice(it, self.args.max_records)
        num = self.work(it)
        end = time.clock()
        print("Read {} records in {} seconds".format(num, (end - start)), file=sys.stderr)
1171188
def print_start_trigger(self, type):
        '''
        '''
        types = {'recieved': 1,
                 'filled': 2,
                 'num_recieved': 3}
        
        if type in types:
            self.send('^PT'+chr(types[type]))
        else:
            raise RuntimeError('Invalid type.')
1049064
def start(self, *args, **kwargs):
        

        @wraps(self.callback)
        def callback():
            os.read(self.timer, 8)
            repeat = self.callback(*args, **kwargs)
            if not repeat:
                self.stop()

        spec = timerfd.itimerspec(self.interval, self.interval)
        timerfd.settime(self.timer, 0, spec)

        self.loop.remove_watcher(self.timer)
        self.loop.add_watcher(self.timer, callback)
211390
async def stderr_handler(self, line):
        

        await self.queue.put(self.clean_bytes(b'[stderr] ' + line))
861842
def _debug(self, out, print_prefix=True):
        
        if self.debug:
            if print_prefix:
                pre = self.__class__.__name__
                if hasattr(self, 'debug_prefix'):
                    pre = getattr(self, 'debug_prefix')
                sys.stderr.write("%s: " % pre)
            sys.stderr.write(out)
184170
def error(self, msg, repeat_at_end=True):
        """"""
        print(msg, file=sys.stderr)
        if repeat_at_end:
            self.error_log.append(msg)
264186
def _start_timeout():
    """"""
    global _timeout

    LOGGER.debug('Adding a new timeout in %i ms', _timeout_interval)
    _maybe_stop_timeout()
    _timeout = ioloop.IOLoop.current().add_timeout(
        ioloop.IOLoop.current().time() + _timeout_interval / 1000.0,
        _on_timeout)
218109
function printTimingAndExit(startTime) {
  const execTime = time() - startTime;

  printColumns(chalk.green(`Finished in: ${execTime.toFixed()}ms`));
  process.exit(0);
}
1343783
async def stderr(self) -> AsyncGenerator[str, None]:
        """"""
        await self.wait_running()
        async for line in self._subprocess.stderr:  # type: ignore
            yield line
454751
def print_timers(self):
      '''  '''
      self.timer += time()
      total_time = self.timer
      tmp = '*  %s  *'
      debug.log(
         '',
         '* '*29,
         tmp%(' '*51),
         tmp%('%s  %s  %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Time (H:M:S)')),
         tmp%('='*51)
      )
      for name in self.list:
         if self.exists(name):
            timer = getattr(self, name).get_time()
            status = getattr(self, name).get_status()
            self.timer -= timer
            debug.log(tmp%(self.return_timer(name, status, timer)))
         else:
            debug.log(tmp%("%s  %s -- : -- : --"%(name[:20].ljust(20),'  '*8)))
      debug.log(
         tmp%(self.return_timer('Wrapper', '', self.timer)),
         tmp%('='*51),
         tmp%(self.return_timer('Total', '', total_time)),
         tmp%(' '*51),
         '* '*29,
         ''
      )
175330
def start(self):
        """"""

        if self.log_filename:
            print('Output will be logged to `%s`.' % self.log_filename)

        start_time = time.strftime(self.timestamp_fmt)
        print('Started %s' % start_time)

        if self.log_filename:
            orig_stdout = sys.stdout
            orig_stderr = sys.stderr

            sys.stdout = self.log_file
            sys.stderr = self.log_file

            print('Started %s' % start_time)

        doit_main = DoitMain(self)
        doit_main.run(['run'])

        stop_time = time.strftime(self.timestamp_fmt)

        if self.log_filename:
            print('Stopped %s' % stop_time)
            print()

            sys.stdout = orig_stdout
            sys.stderr = orig_stderr
            self.log_file.close()

        print('Stopped %s' % stop_time)
570138
def log(self, msg, error=False):
        """"""
        output = self.stdout
        if error:
            output = self.stderr

        output.write(msg)
        output.write('\n')
1110036
def _start_print(self):
        
        if self._start_no_nl:
            sys.stdout.write(self._start_msg)
            sys.stdout.flush()
        else:
            print(self._start_msg)
646461
def _main_loop(self):
        '''
        
        '''
        self.logger.debug("Processing messages")
        old_time = 0
        while True:
            self._process_messages()
            if self.settings['STATS_DUMP'] != 0:
                new_time = int(old_div(time.time(), self.settings['STATS_DUMP']))
                # only log every X seconds
                if new_time != old_time:
                    self._dump_stats()
                    old_time = new_time

            self._report_self()
            time.sleep(self.settings['SLEEP_TIME'])
185749
def timeout(seconds, error_message=None):
    """"""

    def decorated(func):
        result = ""

        def _handle_timeout(signum, frame):
            errmsg = error_message or 'Timeout: The action <%s> is timeout!' % func.__name__
            global result
            result = None
            import inspect
            stack_frame = inspect.stack()[4]
            file_name = os.path.basename(stack_frame[1])
            line_no = stack_frame[2]
            method_name = stack_frame[3]
            code_text = ','.join(stack_frame[4])
            stack_info = 'Stack: %s, %s:%s >%s' % (method_name, file_name, line_no, code_text)
            sys.stderr.write(errmsg+'\n')
            sys.stderr.write(stack_info+'\n')
            raise TimeoutError(errmsg)

        @sysx.platform(sysx.UNIX_LIKE, case_false_wraps=func)
        def wrapper(*args, **kwargs):
            global result
            signal.signal(signal.SIGALRM, _handle_timeout)
            signal.alarm(seconds)

            try:
                result = func(*args, **kwargs)
            finally:
                signal.alarm(0)
                return result

        return functools.wraps(func)(wrapper)

    return decorated