cde.smali

.class public final Ldxoptimizer/cde;
.super Ljava/lang/Object;
.source "CpuUtils.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Ldxoptimizer/cde$b;,
        Ldxoptimizer/cde$a;
    }
.end annotation


# static fields
.field private static final a:[Ljava/lang/String;

.field private static final b:[Ljava/lang/String;

.field private static c:[I


# direct methods
.method static constructor <clinit>()V
    .registers 5

    .prologue
    const/4 v4, 0x2

    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 74
    new-array v0, v4, [Ljava/lang/String;

    const-string v1, "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"

    aput-object v1, v0, v2

    const-string v1, "/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq"

    aput-object v1, v0, v3

    sput-object v0, Ldxoptimizer/cde;->a:[Ljava/lang/String;

    .line 76
    new-array v0, v4, [Ljava/lang/String;

    const-string v1, "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"

    aput-object v1, v0, v2

    const-string v1, "/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq"

    aput-object v1, v0, v3

    sput-object v0, Ldxoptimizer/cde;->b:[Ljava/lang/String;

    .line 79
    const/4 v0, 0x0

    sput-object v0, Ldxoptimizer/cde;->c:[I

    return-void
.end method

.method public static a()Ldxoptimizer/cde$a;
    .registers 8

    .prologue
    const/4 v5, 0x4

    const/4 v0, 0x0

    .line 84
    :try_start_2
    const-string v1, "/proc/stat"

    invoke-static {v1}, Ldxoptimizer/cde;->b(Ljava/lang/String;)Ljava/io/BufferedReader;
    :try_end_7
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_7} :catch_6a
    .catchall {:try_start_2 .. :try_end_7} :catchall_77

    move-result-object v2

    .line 85
    if-nez v2, :cond_10

    .line 102
    if-eqz v2, :cond_f

    .line 104
    :try_start_c
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_f
    .catch Ljava/lang/Exception; {:try_start_c .. :try_end_f} :catch_80

    .line 108
    :cond_f
    :goto_f
    return-object v0

    .line 87
    :cond_10
    :try_start_10
    invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_62

    .line 88
    const-string v3, "\\s+"

    invoke-virtual {v1, v3}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v3

    .line 89
    array-length v1, v3

    if-le v1, v5, :cond_10

    const/4 v1, 0x0

    aget-object v1, v3, v1

    const-string v4, "cpu"

    invoke-virtual {v1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_10

    .line 90
    new-instance v1, Ldxoptimizer/cde$a;

    invoke-direct {v1}, Ldxoptimizer/cde$a;-><init>()V

    .line 91
    const/4 v4, 0x1

    aget-object v4, v3, v4

    const-wide/16 v6, 0x0

    invoke-static {v4, v6, v7}, Ldxoptimizer/cfa;->a(Ljava/lang/String;J)J

    move-result-wide v4

    iput-wide v4, v1, Ldxoptimizer/cde$a;->a:J

    .line 92
    const/4 v4, 0x2

    aget-object v4, v3, v4

    const-wide/16 v6, 0x0

    invoke-static {v4, v6, v7}, Ldxoptimizer/cfa;->a(Ljava/lang/String;J)J

    move-result-wide v4

    iput-wide v4, v1, Ldxoptimizer/cde$a;->b:J

    .line 93
    const/4 v4, 0x3

    aget-object v4, v3, v4

    const-wide/16 v6, 0x0

    invoke-static {v4, v6, v7}, Ldxoptimizer/cfa;->a(Ljava/lang/String;J)J

    move-result-wide v4

    iput-wide v4, v1, Ldxoptimizer/cde$a;->c:J

    .line 94
    const/4 v4, 0x4

    aget-object v3, v3, v4

    const-wide/16 v4, 0x0

    invoke-static {v3, v4, v5}, Ldxoptimizer/cfa;->a(Ljava/lang/String;J)J

    move-result-wide v4

    iput-wide v4, v1, Ldxoptimizer/cde$a;->d:J
    :try_end_5b
    .catch Ljava/lang/Exception; {:try_start_10 .. :try_end_5b} :catch_88
    .catchall {:try_start_10 .. :try_end_5b} :catchall_86

    .line 102
    if-eqz v2, :cond_60

    .line 104
    :try_start_5d
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_60
    .catch Ljava/lang/Exception; {:try_start_5d .. :try_end_60} :catch_82

    :cond_60
    :goto_60
    move-object v0, v1

    .line 95
    goto :goto_f

    .line 102
    :cond_62
    if-eqz v2, :cond_f

    .line 104
    :try_start_64
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_67
    .catch Ljava/lang/Exception; {:try_start_64 .. :try_end_67} :catch_68

    goto :goto_f

    .line 105
    :catch_68
    move-exception v1

    goto :goto_f

    .line 98
    :catch_6a
    move-exception v1

    move-object v2, v0

    .line 100
    :goto_6c
    :try_start_6c
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_6f
    .catchall {:try_start_6c .. :try_end_6f} :catchall_86

    .line 102
    if-eqz v2, :cond_f

    .line 104
    :try_start_71
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_74
    .catch Ljava/lang/Exception; {:try_start_71 .. :try_end_74} :catch_75

    goto :goto_f

    .line 105
    :catch_75
    move-exception v1

    goto :goto_f

    .line 102
    :catchall_77
    move-exception v1

    move-object v2, v0

    move-object v0, v1

    :goto_7a
    if-eqz v2, :cond_7f

    .line 104
    :try_start_7c
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_7f
    .catch Ljava/lang/Exception; {:try_start_7c .. :try_end_7f} :catch_84

    .line 105
    :cond_7f
    :goto_7f
    throw v0

    :catch_80
    move-exception v1

    goto :goto_f

    :catch_82
    move-exception v0

    goto :goto_60

    :catch_84
    move-exception v1

    goto :goto_7f

    .line 102
    :catchall_86
    move-exception v0

    goto :goto_7a

    .line 98
    :catch_88
    move-exception v1

    goto :goto_6c
.end method

.method public static a(I)Ldxoptimizer/cde$b;
    .registers 9

    .prologue
    const/4 v4, 0x0

    const/4 v0, 0x0

    .line 112
    const-string v1, "/proc/%d/stat"

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/Object;

    invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v2, v4

    invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    .line 115
    :try_start_11
    invoke-static {v1}, Ldxoptimizer/cde;->b(Ljava/lang/String;)Ljava/io/BufferedReader;
    :try_end_14
    .catch Ljava/lang/Exception; {:try_start_11 .. :try_end_14} :catch_66
    .catchall {:try_start_11 .. :try_end_14} :catchall_73

    move-result-object v2

    .line 116
    if-nez v2, :cond_1d

    .line 133
    if-eqz v2, :cond_1c

    .line 135
    :try_start_19
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_1c
    .catch Ljava/lang/Exception; {:try_start_19 .. :try_end_1c} :catch_7c

    .line 139
    :cond_1c
    :goto_1c
    return-object v0

    .line 118
    :cond_1d
    :try_start_1d
    invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_5e

    .line 119
    const-string v3, "\\s+"

    invoke-virtual {v1, v3}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v3

    .line 120
    array-length v1, v3

    const/16 v4, 0x14

    if-le v1, v4, :cond_1d

    .line 121
    new-instance v1, Ldxoptimizer/cde$b;

    invoke-direct {v1}, Ldxoptimizer/cde$b;-><init>()V

    .line 122
    iput p0, v1, Ldxoptimizer/cde$b;->a:I

    .line 123
    const/4 v4, 0x2

    aget-object v4, v3, v4

    const/4 v5, 0x0

    invoke-virtual {v4, v5}, Ljava/lang/String;->charAt(I)C

    move-result v4

    iput-char v4, v1, Ldxoptimizer/cde$b;->b:C

    .line 124
    const/16 v4, 0xd

    aget-object v4, v3, v4

    const-wide/16 v6, 0x0

    invoke-static {v4, v6, v7}, Ldxoptimizer/cfa;->a(Ljava/lang/String;J)J

    move-result-wide v4

    iput-wide v4, v1, Ldxoptimizer/cde$b;->c:J

    .line 125
    const/16 v4, 0xe

    aget-object v3, v3, v4

    const-wide/16 v4, 0x0

    invoke-static {v3, v4, v5}, Ldxoptimizer/cfa;->a(Ljava/lang/String;J)J

    move-result-wide v4

    iput-wide v4, v1, Ldxoptimizer/cde$b;->d:J
    :try_end_57
    .catch Ljava/lang/Exception; {:try_start_1d .. :try_end_57} :catch_84
    .catchall {:try_start_1d .. :try_end_57} :catchall_82

    .line 133
    if-eqz v2, :cond_5c

    .line 135
    :try_start_59
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_5c
    .catch Ljava/lang/Exception; {:try_start_59 .. :try_end_5c} :catch_7e

    :cond_5c
    :goto_5c
    move-object v0, v1

    .line 126
    goto :goto_1c

    .line 133
    :cond_5e
    if-eqz v2, :cond_1c

    .line 135
    :try_start_60
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_63
    .catch Ljava/lang/Exception; {:try_start_60 .. :try_end_63} :catch_64

    goto :goto_1c

    .line 136
    :catch_64
    move-exception v1

    goto :goto_1c

    .line 129
    :catch_66
    move-exception v1

    move-object v2, v0

    .line 131
    :goto_68
    :try_start_68
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_6b
    .catchall {:try_start_68 .. :try_end_6b} :catchall_82

    .line 133
    if-eqz v2, :cond_1c

    .line 135
    :try_start_6d
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_70
    .catch Ljava/lang/Exception; {:try_start_6d .. :try_end_70} :catch_71

    goto :goto_1c

    .line 136
    :catch_71
    move-exception v1

    goto :goto_1c

    .line 133
    :catchall_73
    move-exception v1

    move-object v2, v0

    move-object v0, v1

    :goto_76
    if-eqz v2, :cond_7b

    .line 135
    :try_start_78
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_7b
    .catch Ljava/lang/Exception; {:try_start_78 .. :try_end_7b} :catch_80

    .line 136
    :cond_7b
    :goto_7b
    throw v0

    :catch_7c
    move-exception v1

    goto :goto_1c

    :catch_7e
    move-exception v0

    goto :goto_5c

    :catch_80
    move-exception v1

    goto :goto_7b

    .line 133
    :catchall_82
    move-exception v0

    goto :goto_76

    .line 129
    :catch_84
    move-exception v1

    goto :goto_68
.end method

.method private static a(Ljava/lang/String;)Ljava/lang/String;
    .registers 6

    .prologue
    const/4 v0, 0x0

    .line 161
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    .line 164
    :try_start_6
    invoke-static {p0}, Ldxoptimizer/cde;->b(Ljava/lang/String;)Ljava/io/BufferedReader;
    :try_end_9
    .catch Ljava/lang/Exception; {:try_start_6 .. :try_end_9} :catch_4e
    .catchall {:try_start_6 .. :try_end_9} :catchall_3f

    move-result-object v2

    .line 165
    if-nez v2, :cond_12

    .line 176
    if-eqz v2, :cond_11

    .line 178
    :try_start_e
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_11
    .catch Ljava/lang/Exception; {:try_start_e .. :try_end_11} :catch_48

    .line 182
    :cond_11
    :goto_11
    return-object v0

    .line 167
    :cond_12
    :goto_12
    :try_start_12
    invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    if-eqz v3, :cond_33

    .line 168
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->length()I

    move-result v4

    if-lez v4, :cond_23

    const-string v4, "\n"

    invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 169
    :cond_23
    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_26
    .catch Ljava/lang/Exception; {:try_start_12 .. :try_end_26} :catch_27
    .catchall {:try_start_12 .. :try_end_26} :catchall_4c

    goto :goto_12

    .line 172
    :catch_27
    move-exception v1

    .line 174
    :goto_28
    :try_start_28
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_2b
    .catchall {:try_start_28 .. :try_end_2b} :catchall_4c

    .line 176
    if-eqz v2, :cond_11

    .line 178
    :try_start_2d
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_30
    .catch Ljava/lang/Exception; {:try_start_2d .. :try_end_30} :catch_31

    goto :goto_11

    .line 179
    :catch_31
    move-exception v1

    goto :goto_11

    .line 171
    :cond_33
    :try_start_33
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_36
    .catch Ljava/lang/Exception; {:try_start_33 .. :try_end_36} :catch_27
    .catchall {:try_start_33 .. :try_end_36} :catchall_4c

    move-result-object v0

    .line 176
    if-eqz v2, :cond_11

    .line 178
    :try_start_39
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_3c
    .catch Ljava/lang/Exception; {:try_start_39 .. :try_end_3c} :catch_3d

    goto :goto_11

    .line 179
    :catch_3d
    move-exception v1

    goto :goto_11

    .line 176
    :catchall_3f
    move-exception v1

    move-object v2, v0

    move-object v0, v1

    :goto_42
    if-eqz v2, :cond_47

    .line 178
    :try_start_44
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_47
    .catch Ljava/lang/Exception; {:try_start_44 .. :try_end_47} :catch_4a

    .line 179
    :cond_47
    :goto_47
    throw v0

    :catch_48
    move-exception v1

    goto :goto_11

    :catch_4a
    move-exception v1

    goto :goto_47

    .line 176
    :catchall_4c
    move-exception v0

    goto :goto_42

    .line 172
    :catch_4e
    move-exception v1

    move-object v2, v0

    goto :goto_28
.end method

.method public static a([Ljava/lang/Integer;)[Ldxoptimizer/cde$b;
    .registers 4

    .prologue
    .line 152
    array-length v0, p0

    new-array v1, v0, [Ldxoptimizer/cde$b;

    .line 153
    const/4 v0, 0x0

    :goto_4
    array-length v2, p0

    if-ge v0, v2, :cond_16

    .line 154
    aget-object v2, p0, v0

    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    .line 155
    invoke-static {v2}, Ldxoptimizer/cde;->a(I)Ldxoptimizer/cde$b;

    move-result-object v2

    aput-object v2, v1, v0

    .line 153
    add-int/lit8 v0, v0, 0x1

    goto :goto_4

    .line 157
    :cond_16
    return-object v1
.end method

.method public static b()I
    .registers 1

    .prologue
    .line 254
    const-string v0, "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"

    invoke-static {v0}, Ldxoptimizer/cde;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 255
    invoke-static {v0}, Ldxoptimizer/cfa;->a(Ljava/lang/String;)I

    move-result v0

    invoke-static {v0}, Ldxoptimizer/cde;->b(I)I

    move-result v0

    return v0
.end method

.method public static b(I)I
    .registers 5

    .prologue
    .line 267
    int-to-double v0, p0

    const-wide v2, 0x408f400000000000L    # 1000.0

    div-double/2addr v0, v2

    invoke-static {v0, v1}, Ljava/lang/Math;->round(D)J

    move-result-wide v0

    long-to-int v0, v0

    return v0
.end method

.method private static b(Ljava/lang/String;)Ljava/io/BufferedReader;
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/FileNotFoundException;
        }
    .end annotation

    .prologue
    .line 186
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v0

    if-nez v0, :cond_d

    const/4 v0, 0x0

    .line 188
    :goto_c
    return-object v0

    .line 187
    :cond_d
    new-instance v0, Ljava/io/BufferedReader;

    new-instance v1, Ljava/io/FileReader;

    invoke-direct {v1, p0}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V

    invoke-direct {v0, v1}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    goto :goto_c
.end method