Git Product home page Git Product logo

anbabyqaq / timeprofile Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 18 KB

Time Profile原理 如果记录CPU使用情况,可以记录每个方法执行时间。然后根据调用堆栈把每个方法执行的时间累加起来,来反映CPU使用情况。Time Profile并没有事无巨细的记录每个方法的执行时间,而是使用了定时采样方式来反应CPU使用情况。

Objective-C 57.16% C 42.84%

timeprofile's Introduction

TimeProfile

Time Profile原理

利用fishhook OC的 objc_msgSend()方法 并在 _hook_objc_msgSend方法执行前后添加 hook_objc_msgSend_after & hook_objc_msgSend_after 方法 用于记录此方法或者子方法的执行耗时,子方法耗时的深度可以自由定制

如果记录CPU使用情况,可以记录每个方法执行时间。然后根据调用堆栈把每个方法执行的时间累加起来,来反映CPU使用情况。Time Profile并没有事无巨细的记录每个方法的执行时间,而是使用了定时采样方式来反应CPU使用情况。

想要检测任何一个方法耗时,可以打开UIWindow+CallRecordShake.m注释,并且在需要兼容的方法前后调用startTrace() 和 stopTrace() ,摇一摇即可

timeprofile's People

Contributors

anbabyqaq avatar monkeytyl avatar

Watchers

 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.