Example usage for com.google.common.base Stopwatch createStarted

List of usage examples for com.google.common.base Stopwatch createStarted

Introduction

In this page you can find the example usage for com.google.common.base Stopwatch createStarted.

Prototype

@CheckReturnValue
public static Stopwatch createStarted(Ticker ticker) 

Source Link

Document

Creates (and starts) a new stopwatch, using the specified time source.

Usage

From source file:dagger.producers.monitoring.TimingProductionComponentMonitor.java

TimingProductionComponentMonitor(ProductionComponentTimingRecorder recorder, Ticker ticker) {
    this.recorder = recorder;
    this.ticker = ticker;
    this.stopwatch = Stopwatch.createStarted(ticker);
}

From source file:com.twitter.distributedlog.ReadAheadCache.java

public ReadAheadCache(String streamName, StatsLogger statsLogger, AlertStatsLogger alertStatsLogger,
        AsyncNotification notification, int maxCachedRecords, boolean deserializeRecordSet,
        boolean traceDeliveryLatencyEnabled, long deliveryLatencyWarnThresholdMillis, Ticker ticker) {
    this.streamName = streamName;
    this.maxCachedRecords = maxCachedRecords;
    this.notification = notification;
    this.deserializeRecordSet = deserializeRecordSet;

    // create the readahead queue
    readAheadRecords = new LinkedBlockingQueue<LogRecordWithDLSN>();

    // start the idle reader detection
    lastEntryProcessTime = Stopwatch.createStarted(ticker);

    // Flags to control delivery latency tracing
    this.traceDeliveryLatencyEnabled = traceDeliveryLatencyEnabled;
    this.deliveryLatencyWarnThresholdMillis = deliveryLatencyWarnThresholdMillis;
    // Stats//  www .  j  a  v a 2  s.  c om
    StatsLogger readAheadStatsLogger = statsLogger.scope("readahead");
    this.statsLogger = readAheadStatsLogger;
    this.alertStatsLogger = alertStatsLogger;
    this.readAheadDeliveryLatencyStat = readAheadStatsLogger.getOpStatsLogger("delivery_latency");
    this.negativeReadAheadDeliveryLatencyStat = readAheadStatsLogger
            .getOpStatsLogger("negative_delivery_latency");
}