Coder Social home page Coder Social logo

liushaoxing321 / appletrace Goto Github PK

View Code? Open in Web Editor NEW

This project forked from everettjf/appletrace

0.0 1.0 0.0 110.55 MB

🍎Trace tool for iOS/macOS (similar to systrace for Android)

License: MIT License

Objective-C 0.17% Objective-C++ 0.03% Makefile 0.03% C 1.52% C++ 0.22% Python 27.49% JavaScript 2.28% Shell 0.01% HTML 67.79% CSS 0.11% Go 0.35%

appletrace's Introduction

AppleTrace

Trace tool for iOS/macOS

AppleTrace is developed for analyzing app's performance on iOS/macOS.

sample

Feature

  1. User-defined trace section.
  2. [arm64 only] Trace all Objective C methods.

Usage

  1. Produce trace data.
  2. Copy from app's sandbox directory.
  3. Merge (all) trace data files into one file trace.json. (There may be more than 1 trace file.)
  4. Generate trace.html based on trace.json.

See below for more detail.

1. Produce

Until now , there are 2 ways for generating trace data.

  1. Manual set section.

    Call APTBeginSection at the beginning of method ,and APTEndSection at the end of method. For Objective C method (whether instance method or class method), there are APTBegin and APTEnd macro for easy coding.

    void anyKindsOfMethod{
        APTBeginSection("process");
        // some code
        APTEndSection("process");
    }
    
    - (void)anyObjectiveCMethod{
        APTBegin;
        // some code
        APTEnd;
    }
    

    Sample app is sample/ManualSectionDemo.

  2. Dynamic library hooking all objc_msgSend.

    Hooking all objc_msgSend methods (based on HookZz). This only support arm64.

    Sample app is sample/TraceAllMsgDemo.

2. Copy

Using any kinds of method, copy <app's sandbox>/tmp/appletracedata out of Simulator/RealDevice.

appletracedata

3. Merge

Merge/Preprocess the appletracedata.

python merge.py -d <appletracedata directory>

This will produce trace.json in appletracedata directory.

4. Generate

Generate trace.html using catapult.

python catapult/tracing/bin/trace2html appletracedata/trace.json --output=appletracedata/trace.html

open trace.html

SampleData

Open sampledata/trace.html.

Dependencies

  1. catapult
  2. HookZz

Develop Plan

  1. dtrace as data source.

appletrace's People

Contributors

everettjf avatar

Watchers

swear.liu 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.