Giter VIP home page Giter VIP logo

appspector / tracer Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 0.0 3.37 MB

Custom Xcode Instruments package that implements tracing of any activities inside the app. See detailed description here: https://appspector.com/blog/instruments-part-2

Home Page: https://appspector.com

License: MIT License

Objective-C 96.81% Ruby 3.19%
xcode instruments wwdc2018 custom-instruments package objective-c swift

tracer's Introduction

Tracer

This repo contains example project and custom Xcode Instruments package for opentracing-like inspection of any activities in your iOS/macOS app. See detailed description here: https://appspector.com/blog/instruments-part-2

Requirements

os_signpost API is available starting from iOS 12 and macOS 10.14. To install custom package you need Xcode 10.

Installation

To add the package to your Instruments you have to download it from the Releases, extract, doubleclick and install. After that it will appear in the list of instruments. Unfortunately there is no way to install and update it automatically.

To use the package you need to issue appropriate os_signpost calls, which is more convinient using wrapper from TracingModule directory in sample project. Wrapper could be installed via CocoaPods:

pod 'Tracer', '~> 1.0.1'

or manually by just moving TracingModule directory to your project and importing Tracer:

#import <Tracer/ASTracer.h>

Usage

Manual

There are two ways you can play with tracer. First is manually by using the following API:

- (ASScope *)addScope:(NSString *)scopeName;
- (void)removeScope:(NSString *)scopeName;
- (void)startSpan:(NSString *)spanName inScope:(NSString *)scopeName;
- (void)stopSpan:(NSString *)spanName inScope:(NSString *)scopeName success:(BOOL)success;

Scopes and spans are concepts describing activites you want to trace, i.e. if you want to trace your view controllers activities scope coud be a view controller and span - any activity performed within it. Span and scope names should be unique. Stopping a span you can pass success flag which indicates span completion status, failed spans will be displayed red on a graph lane.

Tracing NSOperations

Also you can use tracer to atomatically trace NSOperations using startTracingOperations call:

[[ASTracer tracer] startTracingOperations];

This will install hooks and KVO observers to track operations lifecycle.

Sample app

If you want to play with package yo ucan use Tracer app in the package Xcode project. It allows to create NSOperationQueues and operations inside them and automatically starts tracing them. Install package then start Tracer app, run Instruments, choose blank template add Tracer package to it and start recording:

Resources

About Us

Looking for better debugging instrument? Try AppSpector. With AppSpector you can remotely debug your app running in the same room or on another continent. You can measure app performance, view CoreData and SQLite content, logs, network requests and many more in realtime. This is the instrument that you've been looking for.

tracer's People

Contributors

deszip avatar sergeyzenchenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.