今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

478 lines
11 KiB

.class public final Lcom/google/common/base/Stopwatch;
.super Ljava/lang/Object;
.source "Stopwatch.java"
# annotations
.annotation build Lcom/google/common/annotations/Beta;
.end annotation
.annotation build Lcom/google/common/annotations/GwtCompatible;
emulated = true
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/common/base/Stopwatch$1;
}
.end annotation
# instance fields
.field private elapsedNanos:J
.field private isRunning:Z
.field private startTick:J
.field private final ticker:Lcom/google/common/base/Ticker;
# direct methods
.method constructor <init>()V
.locals 1
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.prologue
.line 127
invoke-static {}, Lcom/google/common/base/Ticker;->systemTicker()Lcom/google/common/base/Ticker;
move-result-object v0
invoke-direct {p0, v0}, Lcom/google/common/base/Stopwatch;-><init>(Lcom/google/common/base/Ticker;)V
.line 128
return-void
.end method
.method constructor <init>(Lcom/google/common/base/Ticker;)V
.locals 1
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.prologue
.line 137
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 138
const-string v0, "ticker"
invoke-static {p1, v0}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/google/common/base/Ticker;
iput-object v0, p0, Lcom/google/common/base/Stopwatch;->ticker:Lcom/google/common/base/Ticker;
.line 139
return-void
.end method
.method private static abbreviate(Ljava/util/concurrent/TimeUnit;)Ljava/lang/String;
.locals 2
.prologue
.line 236
sget-object v0, Lcom/google/common/base/Stopwatch$1;->$SwitchMap$java$util$concurrent$TimeUnit:[I
invoke-virtual {p0}, Ljava/util/concurrent/TimeUnit;->ordinal()I
move-result v1
aget v0, v0, v1
packed-switch v0, :pswitch_data_0
.line 246
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
throw v0
.line 238
:pswitch_0
const-string v0, "ns"
.line 244
:goto_0
return-object v0
.line 240
:pswitch_1
const-string v0, "\u03bcs"
goto :goto_0
.line 242
:pswitch_2
const-string v0, "ms"
goto :goto_0
.line 244
:pswitch_3
const-string v0, "s"
goto :goto_0
.line 236
nop
:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_1
:pswitch_2
:pswitch_3
.end packed-switch
.end method
.method private static chooseUnit(J)Ljava/util/concurrent/TimeUnit;
.locals 4
.prologue
const-wide/16 v2, 0x0
.line 223
sget-object v0, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
sget-object v1, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v0, p0, p1, v1}, Ljava/util/concurrent/TimeUnit;->convert(JLjava/util/concurrent/TimeUnit;)J
move-result-wide v0
cmp-long v0, v0, v2
if-lez v0, :cond_0
.line 224
sget-object v0, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
.line 232
:goto_0
return-object v0
.line 226
:cond_0
sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
sget-object v1, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v0, p0, p1, v1}, Ljava/util/concurrent/TimeUnit;->convert(JLjava/util/concurrent/TimeUnit;)J
move-result-wide v0
cmp-long v0, v0, v2
if-lez v0, :cond_1
.line 227
sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
goto :goto_0
.line 229
:cond_1
sget-object v0, Ljava/util/concurrent/TimeUnit;->MICROSECONDS:Ljava/util/concurrent/TimeUnit;
sget-object v1, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v0, p0, p1, v1}, Ljava/util/concurrent/TimeUnit;->convert(JLjava/util/concurrent/TimeUnit;)J
move-result-wide v0
cmp-long v0, v0, v2
if-lez v0, :cond_2
.line 230
sget-object v0, Ljava/util/concurrent/TimeUnit;->MICROSECONDS:Ljava/util/concurrent/TimeUnit;
goto :goto_0
.line 232
:cond_2
sget-object v0, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
goto :goto_0
.end method
.method public static createStarted()Lcom/google/common/base/Stopwatch;
.locals 1
.prologue
.line 106
new-instance v0, Lcom/google/common/base/Stopwatch;
invoke-direct {v0}, Lcom/google/common/base/Stopwatch;-><init>()V
invoke-virtual {v0}, Lcom/google/common/base/Stopwatch;->start()Lcom/google/common/base/Stopwatch;
move-result-object v0
return-object v0
.end method
.method public static createStarted(Lcom/google/common/base/Ticker;)Lcom/google/common/base/Stopwatch;
.locals 1
.prologue
.line 116
new-instance v0, Lcom/google/common/base/Stopwatch;
invoke-direct {v0, p0}, Lcom/google/common/base/Stopwatch;-><init>(Lcom/google/common/base/Ticker;)V
invoke-virtual {v0}, Lcom/google/common/base/Stopwatch;->start()Lcom/google/common/base/Stopwatch;
move-result-object v0
return-object v0
.end method
.method public static createUnstarted()Lcom/google/common/base/Stopwatch;
.locals 1
.prologue
.line 86
new-instance v0, Lcom/google/common/base/Stopwatch;
invoke-direct {v0}, Lcom/google/common/base/Stopwatch;-><init>()V
return-object v0
.end method
.method public static createUnstarted(Lcom/google/common/base/Ticker;)Lcom/google/common/base/Stopwatch;
.locals 1
.prologue
.line 96
new-instance v0, Lcom/google/common/base/Stopwatch;
invoke-direct {v0, p0}, Lcom/google/common/base/Stopwatch;-><init>(Lcom/google/common/base/Ticker;)V
return-object v0
.end method
.method private elapsedNanos()J
.locals 4
.prologue
.line 191
iget-boolean v0, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/google/common/base/Stopwatch;->ticker:Lcom/google/common/base/Ticker;
invoke-virtual {v0}, Lcom/google/common/base/Ticker;->read()J
move-result-wide v0
iget-wide v2, p0, Lcom/google/common/base/Stopwatch;->startTick:J
sub-long/2addr v0, v2
iget-wide v2, p0, Lcom/google/common/base/Stopwatch;->elapsedNanos:J
add-long/2addr v0, v2
:goto_0
return-wide v0
:cond_0
iget-wide v0, p0, Lcom/google/common/base/Stopwatch;->elapsedNanos:J
goto :goto_0
.end method
# virtual methods
.method public elapsed(Ljava/util/concurrent/TimeUnit;)J
.locals 3
.prologue
.line 205
invoke-direct {p0}, Lcom/google/common/base/Stopwatch;->elapsedNanos()J
move-result-wide v0
sget-object v2, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {p1, v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->convert(JLjava/util/concurrent/TimeUnit;)J
move-result-wide v0
return-wide v0
.end method
.method public isRunning()Z
.locals 1
.prologue
.line 147
iget-boolean v0, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
return v0
.end method
.method public reset()Lcom/google/common/base/Stopwatch;
.locals 2
.prologue
.line 185
const-wide/16 v0, 0x0
iput-wide v0, p0, Lcom/google/common/base/Stopwatch;->elapsedNanos:J
.line 186
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
.line 187
return-object p0
.end method
.method public start()Lcom/google/common/base/Stopwatch;
.locals 3
.prologue
const/4 v1, 0x1
.line 157
iget-boolean v0, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
if-nez v0, :cond_0
move v0, v1
:goto_0
const-string v2, "This stopwatch is already running."
invoke-static {v0, v2}, Lcom/google/common/base/Preconditions;->checkState(ZLjava/lang/Object;)V
.line 158
iput-boolean v1, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
.line 159
iget-object v0, p0, Lcom/google/common/base/Stopwatch;->ticker:Lcom/google/common/base/Ticker;
invoke-virtual {v0}, Lcom/google/common/base/Ticker;->read()J
move-result-wide v0
iput-wide v0, p0, Lcom/google/common/base/Stopwatch;->startTick:J
.line 160
return-object p0
.line 157
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
.method public stop()Lcom/google/common/base/Stopwatch;
.locals 6
.prologue
.line 171
iget-object v0, p0, Lcom/google/common/base/Stopwatch;->ticker:Lcom/google/common/base/Ticker;
invoke-virtual {v0}, Lcom/google/common/base/Ticker;->read()J
move-result-wide v0
.line 172
iget-boolean v2, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
const-string v3, "This stopwatch is already stopped."
invoke-static {v2, v3}, Lcom/google/common/base/Preconditions;->checkState(ZLjava/lang/Object;)V
.line 173
const/4 v2, 0x0
iput-boolean v2, p0, Lcom/google/common/base/Stopwatch;->isRunning:Z
.line 174
iget-wide v2, p0, Lcom/google/common/base/Stopwatch;->elapsedNanos:J
iget-wide v4, p0, Lcom/google/common/base/Stopwatch;->startTick:J
sub-long/2addr v0, v4
add-long/2addr v0, v2
iput-wide v0, p0, Lcom/google/common/base/Stopwatch;->elapsedNanos:J
.line 175
return-object p0
.end method
.method public toString()Ljava/lang/String;
.locals 6
.annotation build Lcom/google/common/annotations/GwtIncompatible;
value = "String.format()"
.end annotation
.prologue
.line 213
invoke-direct {p0}, Lcom/google/common/base/Stopwatch;->elapsedNanos()J
move-result-wide v0
.line 215
invoke-static {v0, v1}, Lcom/google/common/base/Stopwatch;->chooseUnit(J)Ljava/util/concurrent/TimeUnit;
move-result-object v2
.line 216
long-to-double v0, v0
sget-object v3, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
const-wide/16 v4, 0x1
invoke-virtual {v3, v4, v5, v2}, Ljava/util/concurrent/TimeUnit;->convert(JLjava/util/concurrent/TimeUnit;)J
move-result-wide v4
long-to-double v4, v4
div-double/2addr v0, v4
.line 219
const-string v3, "%.4g %s"
const/4 v4, 0x2
new-array v4, v4, [Ljava/lang/Object;
const/4 v5, 0x0
invoke-static {v0, v1}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;
move-result-object v0
aput-object v0, v4, v5
const/4 v0, 0x1
invoke-static {v2}, Lcom/google/common/base/Stopwatch;->abbreviate(Ljava/util/concurrent/TimeUnit;)Ljava/lang/String;
move-result-object v1
aput-object v1, v4, v0
invoke-static {v3, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method