Skip to content

Commit c9a7c86

Browse files
committed
[1.7.0-feature] ASM工具module
1 parent 9beb716 commit c9a7c86

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed

lib_bytecode_common/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

lib_bytecode_common/build.gradle

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
android {
7+
compileSdkVersion App.compileSdkVersion
8+
9+
defaultConfig {
10+
minSdkVersion App.minSdkVersion
11+
targetSdkVersion App.targetSdkVersion
12+
}
13+
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
compileOptions {
21+
sourceCompatibility JavaVersion.VERSION_1_8
22+
targetCompatibility JavaVersion.VERSION_1_8
23+
}
24+
kotlinOptions {
25+
jvmTarget = '1.8'
26+
}
27+
}
28+
29+
dependencies {
30+
31+
implementation Deps.kotlinCore
32+
implementation Deps.androidx_appcompat
33+
implementation Deps.androidx_material
34+
}

lib_bytecode_common/consumer-rules.pro

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="org.ninetripods.lib_bytecode.common">
4+
5+
</manifest>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.ninetripods.lib_bytecode.common
2+
3+
import android.app.Application
4+
import java.util.concurrent.ConcurrentHashMap
5+
6+
/**
7+
* 全局方法耗时Util
8+
*/
9+
object TimeCostUtil {
10+
private const val TAG = "METHOD_COST"
11+
12+
private val staticMethodObj by lazy { StaticMethodObject() }
13+
14+
/**
15+
* 方法Map,其中key:方法名,value:耗时时间
16+
*/
17+
private val METHODS_MAP by lazy { ConcurrentHashMap<String, Long>() }
18+
19+
fun recordMethodStart(methodName: String, clz: Any?) {
20+
try {
21+
METHODS_MAP[methodName] = System.currentTimeMillis()
22+
if (clz is Application) {}
23+
} catch (ex: Exception) {
24+
ex.printStackTrace()
25+
}
26+
}
27+
28+
fun recordMethodEnd() {
29+
30+
}
31+
32+
}
33+
34+
class StaticMethodObject {}

0 commit comments

Comments
 (0)