• Stars
    star
    331
  • Rank 122,547 (Top 3 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📈 CLI to profile compilation time of Swift project

xcprofiler

Build Status Coverage Status Gem Version Gem Download MIT License

Command line utility to profile compilation time of Swift project.

This tool is developed in working time for Cookpad.

Installation

gem install xcprofiler

xcprofiler is tested on latest Ruby 2.3/2.4.

Usage

  1. Add -Xfrontend -debug-time-function-bodies build flags in Build Settings -> Other Swift Flags section of your Xcode project.

  2. Build your project

  3. Execute xcprofiler

$ xcprofiler [PRODUCT_NAME or ACTIVITY_LOG_PATH] [options]

xcprofiler searches the latest build log on your DerivedData directory.

You can also specify the .xcactivitylog.

$ xcprofiler MyApp
$ xcprofiler ~/Library/Developer/Xcode/DerivedData/MyApp-xxxxxxxxxxx/Logs/Build/0761C73D-3B6C-449A-BE89-6D11DAB748FE.xcactivitylog

Sample output is here

+----------------------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+
| File                 | Line | Method name                                                                                                                                                   | Time(ms) |
+----------------------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+
| ResultProtocol.swift | 132  | public func ==<T : ResultProtocol where T.Value : Equatable, T.Error : Equatable>(left: T, right: T) -> Bool                                                  | 14.2     |
| Result.swift         | 66   | get {}                                                                                                                                                        | 13.1     |
| Result.swift         | 78   | public static func error(_ message: String? = default, function: String = #function, file: String = #file, line: Int = #line) -> NSError                      | 6.3      |
| Result.swift         | 69   | get {}                                                                                                                                                        | 2.2      |
| Result.swift         | 132  | public func `try`<T>(_ function: String = #function, file: String = #file, line: Int = #line, try: (NSErrorPointer) -> T?) -> Result<T, NSError>              | 1.7      |
| Result.swift         | 95   | get {}                                                                                                                                                        | 1.4      |
| Result.swift         | 21   | public init(_ value: T?, failWith: @autoclosure () -> Error)                                                                                                  | 0.9      |
| Result.swift         | 142  | public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, try: (NSErrorPointer) -> Bool) -> Result<(), NSError>              | 0.9      |
| ResultProtocol.swift | 172  | @available(*, unavailable, renamed: "recover(with:)") public func recoverWith(_ result: @autoclosure () -> Self) -> Self                                      | 0.7      |
| Result.swift         | 72   | get {}                                                                                                                                                        | 0.6      |
| Result.swift         | 75   | get {}                                                                                                                                                        | 0.6      |
| ResultProtocol.swift | 72   | public func recover(_ value: @autoclosure () -> Value) -> Value                                                                                               | 0.5      |
| ResultProtocol.swift | 111  | public func &&&<L : ResultProtocol, R : ResultProtocol where L.Error == R.Error>(left: L, right: @autoclosure () -> R) -> Result<(L.Value, R.Value), L.Error> | 0.5      |
| ResultProtocol.swift | 144  | public func !=<T : ResultProtocol where T.Value : Equatable, T.Error : Equatable>(left: T, right: T) -> Bool                                                  | 0.5      |
| ResultProtocol.swift | 92   | public func tryMap<U>(_ transform: (Value) throws -> U) -> Result<U, Error>                                                                                   | 0.4      |
| Result.swift         | 175  | @available(*, unavailable, renamed: "success") public static func Success(_: T) -> Result<T, Error>                                                           | 0.3      |
| ResultProtocol.swift | 55   | public func mapError<Error2>(_ transform: (Error) -> Error2) -> Result<Value, Error2>                                                                         | 0.3      |
| ResultProtocol.swift | 77   | public func recover(with result: @autoclosure () -> Self) -> Self                                                                                             | 0.3      |
| ResultProtocol.swift | 93   | (closure)                                                                                                                                                     | 0.3      |
| Result.swift         | 31   | public init(attempt f: () throws -> T)                                                                                                                        | 0.2      |
+----------------------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+

Available Options

option shorthand description
--limit -l Limit for display
--threshold Threshold of time to display (ms)
--show-invalids Show invalid location results
--order -o Sort order (default,time,file)
--derived-data-path Root path of DerivedData directory
--truncate-at -t Truncate the method name with specified length
--no-unique Show the duplicated results

Use custom reporters

You can use reporters to output tracking logs.

require 'xcprofiler'

profiler = Xcprofiler::Profiler.by_product_name('MyApp')
profiler.reporters = [
  Xcprofiler::StandardOutputReporter.new(limit: 20, order: :time),
  Xcprofiler::JSONReporter.new(output_path: 'result.json'),
  Xcprofiler::BlockReporter.new do |executions|
    do_something(executions)
  end,
]
profiler.report!

You can also implement your own reporters.

See implementation of built-in reporters for detail.

danger-xcprofiler

You can integrate xcprofiler to danger.

https://github.com/giginet/danger-xcprofiler

License

MIT License

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/giginet/xcprofiler.

More Repositories

1

Crossroad

🚍 Route URL schemes easily
Swift
415
star
2

Scipio

A new build tool to generate XCFramework
Swift
388
star
3

RxSpriteKit

👾 Reactive Extensions for SpriteKit
Swift
132
star
4

Toybox

🧸 Xcode Playground management made easy
Swift
130
star
5

NESEmulator-watchOS

👾 ⌚ NES Emulator on Apple Watch
Swift
122
star
6

Peafowl

🀄 Play Japanese Mahjong in Swift
Swift
91
star
7

SimRecorder

GIF Recorder for iOS Simulator
Swift
74
star
8

MinSwift-workshop

♻️ minimum Swift compiler written in Swift
Swift
55
star
9

danger-xcprofiler

🚫 danger plugin for asserting Swift compilation time
Ruby
52
star
10

Wormhole

🐛 Wormhole invites you to the fastest trip to AppStore Connect. (NOT STABLE)
Swift
38
star
11

Milepost

🚥 SwiftPM Build Plugin to show Git info on your app
Swift
34
star
12

KawazBuster

かわずたんたたき! for iPhone
Objective-C
25
star
13

FCEUX-watchOS

👾 ⌚ Play NES on watchOS
C++
21
star
14

CustomKeyboardTextField

Provides easy way to make type safety TextField with custom keyboards
Swift
20
star
15

NibLoaderKit

Tiny utility to load UIView/NSView from nibs
Swift
15
star
16

castle

🏰 All my dotfile are belong to us. BUT MY CREDENTIALS ARE IN ANOTHER CASTLE.
Vim Script
15
star
17

JSONMatcher

A JSON matcher extension in Swift for Nimble
Swift
14
star
18

xcode-opener

Open Xcode project by context
Shell
13
star
19

alfred-autojump-workflow

Alfred 2 workflow to provide you a faster way to navigate your filesystem via autojump
Python
12
star
20

KawazCatch

C++
10
star
21

aws-lambda-swift-runtime

Swift
10
star
22

CCSocialShare

Ultimate SNS adapter for cocos2d-x
Java
10
star
23

RubyJang

るびじゃん!〜Rubyで麻雀実装してみた〜
Ruby
10
star
24

beddit-python

API Client for Beddit Sleep Tracker 😴
Python
10
star
25

KawazJet

C++
9
star
26

django-debug-toolbar-vcs-info

Add VCS info onto your django-debug-toolbar
Python
8
star
27

dqx_helper

useful tool collection for DragonQuest X
Python
8
star
28

alfred-ghq-workflow

Search and get repository on GHQ via Alfred
Python
7
star
29

Jubiol

Jubiol is new type shooting game written in CoffeeScript.
CoffeeScript
6
star
30

RikoBuster

Swift
5
star
31

swift-evolution-gpt

Python
5
star
32

peco-anyenv

Switch interpreter versions interactively with fooenv(rbenv, pyenv and others) + peco
Shell
5
star
33

django-slack-invitation

Automatic invitation to Slack team
Python
5
star
34

Kaleidscope-cpp

C++
4
star
35

fastlane-plugin-influxdb

fastlane plugin to post to InfluxDB
Ruby
4
star
36

jquery-3dsmenu

jQuery plugin for listing like Nintendo 3DS home menu.
JavaScript
4
star
37

Heqet

Heqet is an useful utility collection for game development on Kobold2D.
Objective-C
4
star
38

MachiMatch

新感覚アクションパズルゲー!
Python
4
star
39

modern-gb

C
3
star
40

KawazCrash

C++
3
star
41

BrushRush

Rush the doodle by your Brush
Objective-C
3
star
42

Hatena-Bookmark-for-Safari

Safari Extention
JavaScript
3
star
43

scipio-s3-storage

Scipio cache storage backend for AWS S3
Swift
2
star
44

pokedex-legacy

Python
2
star
45

XI

XI[sai] Clone on Unity3D in Boo
C#
2
star
46

docker-gbdk

👾 🐳 Docker image to build Gameboy ROMs with GBDK.
Dockerfile
2
star
47

denops-deckset.vim

Vim/Neovim plugin which enpowers editing Deckset slides
TypeScript
2
star
48

Sockwaz

Sockwaz is live tweet viewer written in CoffeeScript.
CoffeeScript
2
star
49

SantaRochka

Sample Game for GGJ12 on Kobold2D
Objective-C
2
star
50

ribbit

ribbit is the perfect collaboration tool for all creators.
Python
2
star
51

gb-sprite-generator

My first Rust execise.
Rust
2
star
52

UDON-for-iPhone

iPhone習作。UDONを移植してみた。
Objective-C
2
star
53

LoopyLooper

Objective-C
2
star
54

libjwt-swift

Swift modulemaps for libjwt
Swift
2
star
55

django-thumbnailfield

An ImageField with auto thumbnail generation for Django.
2
star
56

RentalDayNotifier

レンタルの返却日を通知します
Objective-C
2
star
57

AutomationTestDemo

This is a demo project for ui testing with TuneupJS
JavaScript
2
star
58

ComplexNetwork

情報工学実験Ⅱ第2回課題
Java
1
star
59

Tekitirs

An old-style shooting game on Unity
Boo
1
star
60

django-star

django plugin
Python
1
star
61

SoukobanSolver

倉庫番解くよ!
Java
1
star
62

Fortress

スタイリッシュ落城ストラテジー!
Objective-C
1
star
63

CCADX2Manager

C++
1
star
64

iGEM-Wiki

JavaScript
1
star
65

MyList

はてな課題2
Perl
1
star
66

experiments

課題用
C++
1
star
67

alfred-irkit-workflow

Alfred workflow to send signal for IRKit.
Python
1
star
68

PatternMatch

情報工学実験Ⅰの課題です
Python
1
star
69

CCMessageWindow

Message Window node for cocos2d-x
C++
1
star
70

kwing.coffee

useful utils for game developing via Kawaz. It extends enchant.js
CoffeeScript
1
star
71

9leapShooting

9leapハッカソン用
JavaScript
1
star
72

Cockatrice

新感覚パズルゲーム
Python
1
star
73

NazoShooting

2010年4月の春のゲーム祭りで開発したシューティングゲーです
Ruby
1
star
74

BeatleFlick

A beat'll flick the beetles.
Objective-C
1
star
75

expeiment3

実験その3
R
1
star
76

LeDA

Level Design Assistant System via Crowdsourcing
Python
1
star
77

gbdev-tools

Python
1
star
78

TwitterClone

はてな課題3
Perl
1
star
79

jquery.pingboard.js

生存戦略しましょうか
CoffeeScript
1
star
80

cocos2d-html5-demo

JavaScript
1
star
81

VirusSimulator

情報工学演習Ⅱの課題
Java
1
star
82

Kwing4Py

Kwing is not Geek!
1
star
83

GCControllerWrapper

GameController.framework for C++
C
1
star
84

gl.enchant.js

CoffeeScript
1
star
85

Kukuri

Kukuri is a PatternMatching Engine for iPad via OpenCV.
C++
1
star
86

RailDesigner

C++
1
star
87

Barca

⚡Barca hastens Carthage packages like lightning.
Swift
1
star
88

ElmsAutoLoginSafariExtension

auto login to ELMS
JavaScript
1
star
89

Flamesc

けしからんゲームです
Python
1
star
90

DanketsuTrokko-kun

This is a demo project of P2P amount multiple devices via GKSession on Kobold2D
Objective-C
1
star
91

FormationPuzzle

Python
1
star