Profiling request time for any active Loggers
974928
public function wp_request_end( $filter_value = null ) {
		foreach ( Logger::$active_loggers as $logger ) {
			$logger->stop_request_timer();
		}
		return $filter_value;
	}
615740
public static void logPerIteration(long startTimeMs, int times, String msg, int workerId) {
    long takenTimeMs = System.currentTimeMillis() - startTimeMs;
    double result = 1000.0 * sFileBytes / takenTimeMs / 1024 / 1024;
    LOG.info(times + msg + workerId + " : " + result + " Mb/sec. Took " + takenTimeMs + " ms. ");
  }
893085
def greenlet_logs(self):
        

        while True:
            try:
                self.flush_logs()
            except Exception as e:  # pylint: disable=broad-except
                self.log.error("When flushing logs: %s" % e)
            finally:
                time.sleep(self.config["report_interval"])
844734
public static function logProfiling(array $log_data)
    {
        if (self::$profiling_count > self::$profiling_max) {
            return;
        }

        self::$profiling_count++;
        if (isset($log_data['errorno'])) {
            self::$profiling[] = array(
                'url'       => $log_data['url'],
                'errorno'   => $log_data['errorno'],
                'error'     => $log_data['error'],
                'queue'     => $log_data['queue'],
            );
        } else {
            self::$profiling[] = array(
                'url'               => $log_data['url'],
                'http_code'         => $log_data['http_code'],
                'total_time'        => $log_data['total_time'],
                'pretransfer_time'  => $log_data['pretransfer_time'],
                'queue'             => $log_data['queue'],
            );
        }
    }
307622
private String getAccessLog(String ip, User visitor, Integer userId, String browser,
                                String url, long elapsedTime) {
        StringBuilder sb = new StringBuilder();
        sb.append(null != ip ? ip : "unknown").append("\t");

        if (visitor == null) {
            sb.append("-\t-\t");
        } else {
            if (userId == null) {
                sb.append("-\t");
            } else {
                sb.append(
                        visitor.getUserId() == userId ? AccessLogType.PORTAL_USER
                                : AccessLogType.MANAGER).append("\t");
            }
            sb.append(visitor.getUserId()).append(",").append(visitor.getUserName()).append(",")
                    .append(visitor.getRoles()).append("\t");
        }

        sb.append(null != userId ? userId : "-").append("\t");
        sb.append(url).append("\t");
        sb.append(browser).append("\t");
        sb.append(elapsedTime).append("ms");
        return sb.toString();
    }
1241586
def log(begin_time, running_num_tks, running_mlm_loss, running_nsp_loss, step_num,
        mlm_metric, nsp_metric, trainer, log_interval):
    """"""
    end_time = time.time()
    duration = end_time - begin_time
    throughput = running_num_tks / duration / 1000.0
    running_mlm_loss = running_mlm_loss / log_interval
    running_nsp_loss = running_nsp_loss / log_interval
    lr = trainer.learning_rate if trainer else 0
    # pylint: disable=line-too-long
    logging.info('[step {}]\tmlm_loss={:.5f}\tmlm_acc={:.5f}\tnsp_loss={:.5f}\tnsp_acc={:.3f}\tthroughput={:.1f}K tks/s\tlr={:.7f} time={:.2f}, latency={:.1f} ms/batch'
                 .format(step_num, running_mlm_loss.asscalar(), mlm_metric.get()[1] * 100, running_nsp_loss.asscalar(),
                         nsp_metric.get()[1] * 100, throughput.asscalar(), lr, duration, duration*1000/log_interval))
156758
private void logSlowRequests(long requestLifetime, Request<?> request,
            byte[] responseContents, StatusLine statusLine) {
        if (DEBUG || requestLifetime > SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("HTTP response for request=<%s> [lifetime=%d], [size=%s], " +
                    "[rc=%d], [retryCount=%s]", request, requestLifetime,
                    responseContents != null ? responseContents.length : "null",
                    statusLine.getStatusCode(), request.getRetryPolicy().getCurrentRetryCount());
        }
    }
1053158
def record_request(status, env)
      now = Time.now
      diff = (now - @start)
      @active_time += diff
      @requests += 1

      $0 = procline

      if @stats
        @stats.timing("#{@stats_prefix}.response_time", diff * 1000)
        if VALID_METHODS.include?(env[REQUEST_METHOD])
          stat = "#{@stats_prefix}.response_time.#{env[REQUEST_METHOD].downcase}"
          @stats.timing(stat, diff * 1000)
        end

        if suffix = status_suffix(status)
          @stats.increment "#{@stats_prefix}.status_code.#{status_suffix(status)}"
        end
        if @track_gc && GC.time > 0
          @stats.timing "#{@stats_prefix}.gc.time", GC.time / 1000
          @stats.count  "#{@stats_prefix}.gc.collections", GC.collections
        end
      end

      reset_horizon if now - horizon > @window
    rescue => boom
      warn "ProcessUtilization#record_request failed: #{boom}"
    end
788710
public function recordProfiling()
    {
        if (is_null($this->connection)) {
            return;
        }

        // turn off the profiler so we don't profile the following queries
        self::$profiling = false;

        foreach ($this->queriesProfiling as $query => $info) {
            $time  = $info['sum_time_ms'];
            $time  = Common::forceDotAsSeparatorForDecimalPoint($time);
            $count = $info['count'];

            $queryProfiling = "INSERT INTO " . Common::prefixTable('log_profiling') . "
						(query,count,sum_time_ms) VALUES (?,$count,$time)
						ON DUPLICATE KEY UPDATE count=count+$count,sum_time_ms=sum_time_ms+$time";
            $this->query($queryProfiling, array($query));
        }

        // turn back on profiling
        self::$profiling = true;
    }
1122480
def logs(self, container=None, pretty=None, previous=False,
             since_seconds=None, since_time=None, timestamps=False,
             tail_lines=None, limit_bytes=None):
        
        log_call = "log"
        params = {}
        if container is not None:
            params["container"] = container
        if pretty is not None:
            params["pretty"] = pretty
        if previous:
            params["previous"] = "true"
        if since_seconds is not None and since_time is None:
            params["sinceSeconds"] = int(since_seconds)
        elif since_time is not None and since_seconds is None:
            params["sinceTime"] = since_time
        if timestamps:
            params["timestamps"] = "true"
        if tail_lines is not None:
            params["tailLines"] = int(tail_lines)
        if limit_bytes is not None:
            params["limitBytes"] = int(limit_bytes)

        query_string = urlencode(params)
        log_call += "?{}".format(query_string) if query_string else ""
        kwargs = {
            "version": self.version,
            "namespace": self.namespace,
            "operation": log_call,
        }
        r = self.api.get(**self.api_kwargs(**kwargs))
        r.raise_for_status()
        return r.text
1369337
def profiled_thread(func):
    """'"""

    def wrapper(*args, **kwargs):
        profile = Profile()
        profile.enable()
        try:
            func(*args, **kwargs)
        finally:
            profile.disable()
        try:
            thread = current_thread()
            profile.dump_stats('profile_%s.%s.%s.log' % (getpid(), thread.name, thread.ident))
        except:
            logger.exception('Failed to dump stats')

    return wrapper
1168839
def _timing(f, logs_every=100):
  """"""
  @functools.wraps(f)
  def wrap(*args, **kw):
    """The timer function."""
    ts = _time.time()
    result = f(*args, **kw)
    te = _time.time()
    qj._call_counts[f] += 1
    qj._timings[f] += (te - ts)
    count = qj._call_counts[f]
    if count % logs_every == 0:
      qj(x='%2.4f seconds' % (qj._timings[f] / count),
         s='Average timing for %s across %d call%s' % (f, count, '' if count == 1 else 's'), _depth=2)
    return result
  return wrap
299040
function () {
            // The strategy to send logs is either after a certain delay, or when the stack is bigger than ...
            var now = new Date().getTime();
            if (this._logStack.length > this.minimumLogNb && now > this._lastLogSent + this.minimumInterval) {
                this._lastLogSent = new Date().getTime();
                this._sendStack();
                this._logStack = [];
            }
        }
1355341
public static void main(String[] args) {
        MeterRegistry registry = SampleConfig.myMonitoringSystem();

        Timer timer = Timer.builder("timer")
            .publishPercentiles(0.5, 0.95)
            .register(registry);

        Object placeholder = new Object();
        AtomicLong totalTimeNanos = new AtomicLong(0);
        AtomicLong totalCount = new AtomicLong(0);

        FunctionTimer.builder("ftimer", placeholder, p -> totalCount.get(), p -> totalTimeNanos.get(), TimeUnit.NANOSECONDS)
            .register(registry);

        RandomEngine r = new MersenneTwister64(0);
        Normal incomingRequests = new Normal(0, 1, r);
        Normal duration = new Normal(250, 50, r);

        AtomicInteger latencyForThisSecond = new AtomicInteger(duration.nextInt());
        Flux.interval(Duration.ofSeconds(1))
            .doOnEach(d -> latencyForThisSecond.set(duration.nextInt()))
            .subscribe();

        // the potential for an "incoming request" every 10 ms
        Flux.interval(Duration.ofMillis(10))
            .doOnEach(d -> {
                if (incomingRequests.nextDouble() + 0.4 > 0) {
                    // pretend the request took some amount of time, such that the time is
                    // distributed normally with a mean of 250ms
                    timer.record(latencyForThisSecond.get(), TimeUnit.MILLISECONDS);
                    totalCount.incrementAndGet();
                    totalTimeNanos.addAndGet((long) TimeUtils.millisToUnit(latencyForThisSecond.get(), TimeUnit.NANOSECONDS));
                }
            })
            .blockLast();
    }
506506
protected void log(HttpServletRequest httpRequest, String requestName, long duration,
			boolean systemError, int responseSize) {
		if (!logEnabled) {
			return;
		}
		final String filterName = filterConfig.getFilterName();
		LOG.logHttpRequest(httpRequest, requestName, duration, systemError, responseSize,
				filterName);
	}
204732
public static void logStatus(final Logger logger, final long startTime,
			final long sleepingTime, final long workingTime)
	{

		logger.logMessage(
				Level.DEBUG,
				"Consumer-Status-Report ["
						+ Time.toClock(System.currentTimeMillis() - startTime)
						+ "]" + "\tEFFICIENCY\t "
						+ MathUtilities.percentPlus(workingTime, sleepingTime)
						+ "\tWORK  [" + Time.toClock(workingTime) + "]"
						+ "\tSLEEP [" + Time.toClock(sleepingTime) + "]");
	}
353782
def _LogProgressUpdateIfReasonable(self):
    """"""
    next_log_time = (
        self._time_of_last_status_log +
        self.SECONDS_BETWEEN_STATUS_LOG_MESSAGES)
    current_time = time.time()
    if current_time < next_log_time:
      return
    completion_time = time.ctime(current_time + self.EstimateTimeRemaining())
    log_message = (
        '{0:s} hash analysis plugin running. {1:d} hashes in queue, '
        'estimated completion time {2:s}.'.format(
            self.NAME, self.hash_queue.qsize(), completion_time))
    logger.info(log_message)
    self._time_of_last_status_log = current_time