GithubHelp home page GithubHelp logo

chapter07's Introduction

Chapter07

这个Sample是学习如何给代码加入Trace Tag, 大家可以将这个代码运用到自己的项目中,然后利用systrace查看结果

结果如下:

    protected void onResume() {
        TraceTag.i("com.sample.systrace.MainActivity.onResume.()V");
        super.onResume();
        Log.i("MainActivity", "[onResume]");
        TraceTag.o();
    }

操作步骤

操作步骤如下:

  1. 使用Android Studio打开工程Chapter07
  2. 运行gradle task ":systrace-gradle-plugin:buildAndPublishToLocalMaven" 编译plugin插件
  3. 使用Android Studio单独打开工程systrace-sample-android
  4. 编译app

注意事项

在systrace-sample-android工程中,需要注意以下几点:

  1. 插桩代码会自动过滤短函数,过滤结果输出到Chapter07/systrace-sample-android/app/build/systrace_output/Debug.ignoremethodmap
  2. 我们也可以单独控制不插桩的白名单,配置文件位于Chapter07/systrace-sample-android/app/blacklist/blackMethodList.txt, 可以指定class或者包名。
  3. 插桩后的class文件在目录Chapter07/systrace-sample-android/app/build/systrace_output/classes中查看。

然后运行应用,需要打开systrace

python $ANDROID_HOME/platform-tools/systrace/systrace.py gfx view wm am pm ss dalvik app sched -b 90960 -a com.sample.systrace  -o test.log.html

chapter07's People

Contributors

shwenzhang avatar dodola avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.