r"""Print start and finish with time measure and kernel count.
779948
def printstartfinish(verb, inp=None, kcount=None):
    """
    if inp:
        if verb > 1:
            ttxt = str(timedelta(seconds=default_timer() - inp))
            ktxt = ' '
            if kcount:
                ktxt += str(kcount) + ' kernel call(s)'
            print('\n:: empymod END; runtime = ' + ttxt + ' ::' + ktxt + '\n')
    else:
        t0 = default_timer()
        if verb > 2:
            print("\n:: empymod START  ::\n")
        return t0
34419
def display(self):
        """"""

        table_list = []
        table_list.append(("Text","Orig. Text","Start time","End time", "Phonetic"))
        for unit in self.unit_list:
            table_list.append((unit.text,
                               "/".join(unit.original_text),
                               unit.start_time,
                               unit.end_time,
                               unit.phonetic_representation))
        print_table(table_list)
1363474
def output_before_run(self, run):
        
        # output in terminal
        runSet = run.runSet
        try:
            OutputHandler.print_lock.acquire()

            try:
                runSet.started_runs += 1
            except AttributeError:
                runSet.started_runs = 1

            timeStr = time.strftime("%H:%M:%S", time.localtime()) + "   "
            progressIndicator = " ({0}/{1})".format(runSet.started_runs, len(runSet.runs))
            terminalTitle = TERMINAL_TITLE.format(runSet.full_name + progressIndicator)
            if self.benchmark.num_of_threads == 1:
                util.printOut(terminalTitle + timeStr + self.format_sourcefile_name(run.identifier, runSet), '')
            else:
                util.printOut(terminalTitle + timeStr + "starting   " + self.format_sourcefile_name(run.identifier, runSet))
        finally:
            OutputHandler.print_lock.release()
708435
def _print_breakdown(cls, savedir, fname, data):
        """"""
        if not os.path.exists(savedir):
            os.makedirs(savedir)

        with open(os.path.join(savedir, fname), 'w') as fout:
            fout.write(data)
959767
def print_packet_range():
    """"""
    first_packet = next(iter(archive.list_packets()))
    last_packet = next(iter(archive.list_packets(descending=True)))
    print('First packet:', first_packet)
    print('Last packet:', last_packet)

    td = last_packet.generation_time - first_packet.generation_time
    print('Timespan:', td)
764276
def _print_result_info(traces, events):
    
    print_v('Returning %i traces:'%len(traces))
    for r in sorted(traces.keys()):
        x = traces[r]
        print_v('  %s (%s): %s -> %s (min: %s, max: %s, len: %i)'%(r, type(x), x[0],x[-1],min(x),max(x),len(x)))
    print_v('Returning %i events:'%len(events))
    for r in sorted(events.keys()):
        x = events[r]
        print_v('  %s: %s -> %s (len: %i)'%(r, x[0] if len(x)>0 else '-',x[-1] if len(x)>0 else '-',len(x)))
634083
def _print_duration(self):
        ''''''
        duration = int(time.time() - self._start_time)
        self._print(datetime.timedelta(seconds=duration))
146314
def main():
    """"""
    arguments = docopt.docopt(__doc__, version=__version__)
    colorlogs()
    # Read input file file


    wrapper = BMIWrapper(
        engine=arguments['<engine>'],
        configfile=arguments['<config>'] or ''
    )


    # add logger if required
    if not arguments['--disable-logger']:
        logging.root.setLevel(logging.DEBUG)
        wrapper.set_logger(logging.root)

    with wrapper as model:
        # if siginfo is supported by OS (BSD)
        def handler(signum, frame):
            """report progress information"""
            t_start = model.get_start_time()
            t_end = model.get_end_time()
            t_current = model.get_current_time()
            total = (t_end - t_start)
            now = (t_current - t_start)
            if total > 0:
                logging.info("progress: %s%%", 100.0 * now / total)
            else:
                logging.info("progress: unknown")

        if hasattr(signal, 'SIGINFO'):
            # attach a siginfo handler (CTRL-t) to print progress
            signal.signal(signal.SIGINFO, handler)

        if arguments['--info']:
            logging.info("%s", trace(model))
        t_end = model.get_end_time()
        t = model.get_start_time()
        while t < t_end:
            model.update(-1)
            t = model.get_current_time()
        if arguments['--info']:
            logging.info("%s", trace(model))
1098237
def printDiagnostics(exp, sequences, objects, args, verbosity=0):
  """"""
  print "Experiment start time:", time.ctime()
  print "\nExperiment arguments:"
  pprint.pprint(args)

  r = sequences.objectConfusion()
  print "Average common pairs in sequences=", r[0],
  print ", features=",r[2]

  r = objects.objectConfusion()
  print "Average common pairs in objects=", r[0],
  print ", locations=",r[1],
  print ", features=",r[2]

  # For detailed debugging
  if verbosity > 0:
    print "\nObjects are:"
    for o in objects:
      pairs = objects[o]
      pairs.sort()
      print str(o) + ": " + str(pairs)
    print "\nSequences:"
    for i in sequences:
      print i,sequences[i]

  print "\nNetwork parameters:"
  pprint.pprint(exp.config)
702187
def report_progress(self):
        """"""
        percent = self.calc_percent()
        total = format_bytes(self._total)

        speed = self.calc_speed()
        total_speed_report = '{0} at {1}'.format(total, speed)

        report = '\r{0: <56} {1: >30}'.format(percent, total_speed_report)

        if self._finished:
            print(report)
        else:
            print(report, end="")
        sys.stdout.flush()
42234
def capture_print(file_dest_maybe: Optional[IO] = None):
    """"""
    file_dest: IO = file_dest_maybe or sys.stderr

    def _print_progress(progress_min: float, rt_remaining: float, _mc: MeasureComparison) -> None:
        nonlocal file_dest
        percent_progress = progress_min * 100.0
        time_remaining, unit = _display_time(rt_remaining)
        print(
            f"Progress: {percent_progress:.1f}% -- Time remaining: {time_remaining} {unit}          ",
            end="\r",
            file=file_dest
        )

    return _print_progress
824723
def print_stats(self):
        """"""
        funcname = self.fn.__name__
        filename = self.fn.__code__.co_filename
        lineno = self.fn.__code__.co_firstlineno
        print("")
        print("*** PROFILER RESULTS ***")
        print("%s (%s:%s)" % (funcname, filename, lineno))
        if self.skipped:
            skipped = "(%d calls not profiled)" % self.skipped
        else:
            skipped = ""
        print("function called %d times%s" % (self.ncalls, skipped))
        print("")
        stats = self.stats
        if self.filename:
            stats.dump_stats(self.filename)
        if not self.dirs:
            stats.strip_dirs()
        stats.sort_stats(*self.sort)
        stats.print_stats(self.entries)
454539
def cli_progress(addr, offset, size):
    """"""
    width = 25
    done = offset * width // size
    print("\r0x{:08x} {:7d} [{}{}] {:3d}% "
          .format(addr, size, '=' * done, ' ' * (width - done),
                  offset * 100 // size), end="")
    try:
        sys.stdout.flush()
    except OSError:
        pass # Ignore Windows CLI "WinError 87" on Python 3.6
    if offset == size:
        print("")
175470
private static void printData()
   {
      Map<String, StatisticsContext> tmpContexts = CONTEXTS;
      for (StatisticsContext context : tmpContexts.values())
      {
         printData(context);
      }
   }
218109
function printTimingAndExit(startTime) {
  const execTime = time() - startTime;

  printColumns(chalk.green(`Finished in: ${execTime.toFixed()}ms`));
  process.exit(0);
}
1353028
def read_data_by_variable(self, mask=True):
        """"""
        def print_elapsed_time(start, last_stopped, prefix):
            # print(f"{prefix} - Elapsed time [s] since start / last stopped: \
            #     {(int(time.time() - start_time))} / {(int(time.time() - last_stopped))}")
            return time.time()
        start_time = time.time()
        last_stopped = time.time()
        last_stopped = print_elapsed_time(start_time, last_stopped, "Starting chunk function")

        verbose = False

        self.read_data()
        last_stopped = print_elapsed_time(start_time, last_stopped, "Data read")

        # 2.
        sc_chunk = self.convert_data_to_dataframe()
        last_stopped = print_elapsed_time(start_time, last_stopped, "Data converted to df")


        # 3.B.
        if mask:
            # 3.A.
            ilocs_qa = np.where((self.df_layers["band"] == self.qa).values)[0]
            df_qa = self.data.iloc[:, ilocs_qa]
            df_qa.columns = self.df_layers["date"].iloc[ilocs_qa]
            df_clearsky = df_qa.isin(self.qa_valid)
            last_stopped = print_elapsed_time(start_time, last_stopped, "Clearsky df created")

            return_bands = self.variables
        else:
            return_bands = self.variables + [self.qa]

        dfs_variables = {}
        for var in return_bands:
            if verbose:
                print("VARIABLE:", var)
            ilocs_var = np.where((self.df_layers["band"] == var).values)[0]
            df_var = self.data.iloc[:, ilocs_var]
            df_var.columns = self.df_layers["date"].iloc[ilocs_var]
            if mask:
                df_var = df_var.where(df_clearsky, other=np.nan)
            dfs_variables[var] = df_var
        last_stopped = print_elapsed_time(start_time, last_stopped, "Clearsky df created")
        self._data = dfs_variables
        return self
446953
def monitor_counters(mc, output, counters, detailed, f):
    """"""
    # Print CSV header
    output.write("time,{}{}\n".format("x,y," if detailed else "",
                                      ",".join(counters)))

    system_info = mc.get_system_info()

    # Make an initial sample of the counters
    last_counter_values = sample_counters(mc, system_info)

    start_time = time.time()

    for _ in f():
        # Snapshot the change in counter values
        counter_values = sample_counters(mc, system_info)
        delta = deltas(last_counter_values, counter_values)
        last_counter_values = counter_values

        now = time.time() - start_time

        # Output the changes
        if detailed:
            for x, y in sorted(system_info):
                output.write("{:0.1f},{},{},{}\n".format(
                    now, x, y,
                    ",".join(str(getattr(delta[(x, y)], c))
                             for c in counters)))
        else:
            totals = [0 for _ in counters]
            for xy in sorted(system_info):
                for i, counter in enumerate(counters):
                    totals[i] += getattr(delta[xy], counter)
            output.write("{:0.1f},{}\n".format(
                now, ",".join(map(str, totals))))