com.google.common.base.Stopwatch.createUnstarted()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(342)

本文整理了Java中com.google.common.base.Stopwatch.createUnstarted()方法的一些代码示例,展示了Stopwatch.createUnstarted()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stopwatch.createUnstarted()方法的具体详情如下:
包路径:com.google.common.base.Stopwatch
类名称:Stopwatch
方法名:createUnstarted

Stopwatch.createUnstarted介绍

[英]Creates (but does not start) a new stopwatch using System#nanoTimeas its time source.
[中]使用系统#纳米计时器作为时间源创建(但不启动)新秒表。

代码示例

代码示例来源:origin: kairosdb/kairosdb

public ProcessTimer(AdaptiveCongestionController congestionController)
{
  m_timer = Stopwatch.createUnstarted();
  m_adaptiveCongestionController = congestionController;
}

代码示例来源:origin: kairosdb/kairosdb

public IngestFutureTask(Callable<Integer> callable)
{
  super(callable);
  m_stopwatch = Stopwatch.createUnstarted();
}

代码示例来源:origin: ben-manes/caffeine

public PolicyStats(String name) {
 this.name = requireNonNull(name);
 this.stopwatch = Stopwatch.createUnstarted();
}

代码示例来源:origin: Graylog2/graylog2-server

public PipelineInterpreterTracer() {
  executionTrace = new ArrayList<>();
  timer = Stopwatch.createUnstarted();
  simulatorInterpreterListener = new SimulatorInterpreterListener(this);
}

代码示例来源:origin: google/error-prone

public DiffApplier(int diffParallelism, FileSource source, FileDestination destination) {
 Preconditions.checkNotNull(source);
 Preconditions.checkNotNull(destination);
 this.diffsFailedPaths = new ConcurrentSkipListSet<>();
 this.refactoredPaths = Sets.newConcurrentHashSet();
 this.source = source;
 this.destination = destination;
 this.completedFiles = new AtomicInteger(0);
 this.stopwatch = Stopwatch.createUnstarted();
 // configure a bounded queue and a rejectedexecutionpolicy.
 // In this case CallerRuns may be appropriate.
 this.workerService =
   new ThreadPoolExecutor(
     0,
     diffParallelism,
     5,
     TimeUnit.SECONDS,
     new ArrayBlockingQueue<Runnable>(50),
     new ThreadPoolExecutor.CallerRunsPolicy());
}

代码示例来源:origin: google/j2objc

final Stopwatch stopwatch = Stopwatch.createUnstarted();

代码示例来源:origin: Alluxio/alluxio

@Override
 public void run() {
  Stopwatch sw = Stopwatch.createUnstarted();
  Map<String, GarbageCollectorMXBean> gcBeanMapBeforeSleep = getGarbageCollectorMXBeans();
  while (true) {
   sw.reset().start();
   try {
    Thread.sleep(mGcSleepIntervalMs);
   } catch (InterruptedException ie) {
    LOG.warn(ie.getStackTrace());
    return;
   }
   long extraTime = sw.elapsed(TimeUnit.MILLISECONDS) - mGcSleepIntervalMs;
   mTotalExtraTimeMs += extraTime;
   Map<String, GarbageCollectorMXBean> gcBeanMapAfterSleep = getGarbageCollectorMXBeans();
   if (extraTime > mWarnThresholdMs) {
    mInfoTimeExceeded++;
    mWarnTimeExceeded++;
    LOG.warn(formatLogString(extraTime, gcBeanMapBeforeSleep, gcBeanMapAfterSleep));
   } else if (extraTime > mInfoThresholdMs) {
    mInfoTimeExceeded++;
    LOG.info(formatLogString(
      extraTime, gcBeanMapBeforeSleep, gcBeanMapAfterSleep));
   }
   gcBeanMapBeforeSleep = gcBeanMapAfterSleep;
  }
 }
}

代码示例来源:origin: apache/hive

@Override
public void run() {
 Stopwatch sw = Stopwatch.createUnstarted();
 Map<String, GcTimes> gcTimesBeforeSleep = getGcTimes();
 Counter jvmPauseWarnCnt = Metrics.getOrCreateCounter(MetricsConstants.JVM_PAUSE_WARN);

代码示例来源:origin: google/guava

public void testCreateUnstarted() {
 Stopwatch unstartedStopwatch = Stopwatch.createUnstarted();
 assertFalse(unstartedStopwatch.isRunning());
 assertEquals(0, unstartedStopwatch.elapsed(NANOSECONDS));
}

代码示例来源:origin: apache/hive

@Override
public void run() {
 Stopwatch sw = Stopwatch.createUnstarted();
 Map<String, GcTimes> gcTimesBeforeSleep = getGcTimes();
 while (shouldRun) {
  sw.reset().start();
  try {
   Thread.sleep(SLEEP_INTERVAL_MS);
  } catch (InterruptedException ie) {
   return;
  }
  long extraSleepTime = sw.elapsed(TimeUnit.MILLISECONDS) - SLEEP_INTERVAL_MS;
  Map<String, GcTimes> gcTimesAfterSleep = getGcTimes();
  if (extraSleepTime > warnThresholdMs) {
   ++numGcWarnThresholdExceeded;
   LOG.warn(formatMessage(
    extraSleepTime, gcTimesAfterSleep, gcTimesBeforeSleep));
   incrementMetricsCounter(MetricsConstant.JVM_PAUSE_WARN, 1);
  } else if (extraSleepTime > infoThresholdMs) {
   ++numGcInfoThresholdExceeded;
   LOG.info(formatMessage(
    extraSleepTime, gcTimesAfterSleep, gcTimesBeforeSleep));
   incrementMetricsCounter(MetricsConstant.JVM_PAUSE_INFO, 1);
  }
  incrementMetricsCounter(MetricsConstant.JVM_EXTRA_SLEEP, extraSleepTime);
  totalGcExtraSleepTime += extraSleepTime;
  gcTimesBeforeSleep = gcTimesAfterSleep;
 }
}

代码示例来源:origin: twitter/distributedlog

protected final OpStatsLogger opStatsLogger;
private final Promise<Response> result = new Promise<Response>();
protected final Stopwatch stopwatch = Stopwatch.createUnstarted();
protected final Long checksum;
protected final Feature checksumDisabledFeature;

代码示例来源:origin: apache/incubator-druid

public static boolean conditionValid(IndexingServiceCondition condition, long timeout)
 {
  try {
   Stopwatch stopwatch = Stopwatch.createUnstarted();
   stopwatch.start();
   while (!condition.isValid()) {
    Thread.sleep(100);
    if (stopwatch.elapsed(TimeUnit.MILLISECONDS) > timeout) {
     throw new ISE("Condition[%s] not met", condition);
    }
   }
  }
  catch (Exception e) {
   log.warn(e, "Condition[%s] not met within timeout[%,d]", condition, timeout);
   return false;
  }
  return true;
 }
}

代码示例来源:origin: twitter/distributedlog

stopwatch = Stopwatch.createUnstarted();
while (true) {
  try {

代码示例来源:origin: twitter/distributedlog

stopwatch = Stopwatch.createUnstarted();
while (true) {
  try {

代码示例来源:origin: lenskit/lenskit

ProgressLogger(Logger log) {
  logger = log;
  timer = Stopwatch.createUnstarted();
}

代码示例来源:origin: apache/incubator-druid

public void profileRun()
 Stopwatch watch = Stopwatch.createUnstarted();
 LoadQueuePeonTester fromPeon = new LoadQueuePeonTester();
 LoadQueuePeonTester toPeon = new LoadQueuePeonTester();

代码示例来源:origin: apache/incubator-druid

public void bigProfiler()
 Stopwatch watch = Stopwatch.createUnstarted();
 int numSegments = 55000;
 int numServers = 50;

代码示例来源:origin: lenskit/lenskit

private TrackedJob(TrackedJob parent, String type, String description) {
  this.parent = parent;
  this.type = type;
  this.description = description;
  this.eventBus = parent.getEventBus();
  this.uuid = UUID.randomUUID();
  timer = Stopwatch.createUnstarted();
}

代码示例来源:origin: twitter/distributedlog

LOG.debug("Starting async reader at {}", startDLSN);
this.startDLSN = startDLSN;
this.scheduleDelayStopwatch = Stopwatch.createUnstarted();
this.readNextDelayStopwatch = Stopwatch.createStarted();
this.positionGapDetectionEnabled = bkdlm.getConf().getPositionGapDetectionEnabled();

代码示例来源:origin: twitter/distributedlog

this.tracker = new ReadAheadTracker(logMetadata.getLogName(), readAheadCache,
    ReadAheadPhase.SCHEDULE_READAHEAD, readAheadPerStreamStatsLogger);
this.resumeStopWatch = Stopwatch.createUnstarted();

相关文章