A plugin to inject tracing code to specified methods.
Branch: master
Clone or download
Latest commit fa8df70 Jul 12, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Add license file Jul 11, 2018
README.md Add filterClass support Jul 12, 2018
build.gradle Upgrade android build gradle plugin Jun 26, 2018
gradle.properties Initial commit May 22, 2018
gradlew Initial commit May 22, 2018
gradlew.bat Initial commit May 22, 2018
settings.gradle Change project structure Jun 28, 2018



Apache 2.0 License Release

This plugin can inject Trace.beginSection() & Trace.endSection to the methods which you specify in build-time. It's useful when you want to trace the methods of third-party libraries.

In addition, this plugin supports incremental work. So its build performance is not bad.


Intergate this gralde plugin:

buildscript {
    repositories {
        maven { url "https://jitpack.io" }
    dependencies {
        classpath "com.github.nekocode:ASM-Systrace:${lastest-verion}"

Create a groovy script and define two filter methods inside:

// Only handle the class you specify can speed up the build
static boolean filterClass(
        String className // Example: android/support/v4/app/Fragment
) {
    // Return true if you want to continue filter methods in this class
    return className.startsWith('cn/nekocode/asm_systrace/example/SomeClass')

static String filterMethod(
        String className, // Example: android/support/v4/app/Fragment
        String methodName, // Example: getLayoutInflater
        String methodDesc // Example: (Landroid/os/Bundle;)Landroid/view/LayoutInflater
) {
    if (methodName != 'b') return null // Retrun null to skip this method
    return className.split('/').last() + '#' + methodName // Return tracing tag

Apply and configure the plugin:

apply plugin: 'asm-systrace'

asmSystrace {
    filterScript = project.file("filter.groovy") // The script you created in the pervious step