fix bugs faster using activity tracing - apple inc. · 2016-07-08 · fix bugs faster using...
TRANSCRIPT
![Page 1: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/1.jpg)
© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
#WWDC14
Fix Bugs Faster Using Activity Tracing
Session 714 Eric Clements Core OS Engineering
Core OS
![Page 2: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/2.jpg)
Overview
![Page 3: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/3.jpg)
Overview
Background
![Page 4: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/4.jpg)
Overview
Background
Activities
![Page 5: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/5.jpg)
Overview
Background
Activities
Breadcrumbs
![Page 6: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/6.jpg)
Overview
Background
Activities
Breadcrumbs
Trace messages
![Page 7: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/7.jpg)
Overview
Background
Activities
Breadcrumbs
Trace messages
Tools
![Page 8: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/8.jpg)
Overview
Background
Activities
Breadcrumbs
Trace messages
Tools
Considerations
![Page 9: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/9.jpg)
Background
![Page 10: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/10.jpg)
Asynchronous Development
![Page 11: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/11.jpg)
Asynchronous Development
XPC, GCD and NSOperationQueue simplify complex tasks
![Page 12: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/12.jpg)
Asynchronous Development
XPC, GCD and NSOperationQueue simplify complex tasks
Difficult to debug and diagnose issues
![Page 13: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/13.jpg)
Asynchronous Development
XPC, GCD and NSOperationQueue simplify complex tasks
Difficult to debug and diagnose issues
Privilege separation exacerbates the problem
![Page 14: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/14.jpg)
Asynchronous Development
XPC, GCD and NSOperationQueue simplify complex tasks
Difficult to debug and diagnose issues
Privilege separation exacerbates the problem
Debug tools have not kept pace
![Page 15: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/15.jpg)
Asynchronous Development
XPC, GCD and NSOperationQueue simplify complex tasks
Difficult to debug and diagnose issues
Privilege separation exacerbates the problem
Debug tools have not kept pace
Existing logging mechanisms are insufficient
![Page 16: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/16.jpg)
Diagnostic Challenges
![Page 17: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/17.jpg)
Diagnostic Challenges
Daemon !9395 Thread_140181 9395 _dispatch_mgr_thread (in libdispatch.dylib) 9395 _dispatch_mgr_invoke (in libdispatch.dylib) 9395 kevent64 (in libsystem_kernel.dylib) !9395 Thread_140182 9395 _dispatch_sig_thread (in libdispatch.dylib) 9395 _dispatch_sigsuspend (in libdispatch.dylib) 9395 __sigsuspend_nocancel (in libsystem_kernel.dylib)
![Page 18: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/18.jpg)
Diagnostic Challenges
Daemon !9395 Thread_140181 9395 _dispatch_mgr_thread (in libdispatch.dylib) 9395 _dispatch_mgr_invoke (in libdispatch.dylib) 9395 kevent64 (in libsystem_kernel.dylib) !9395 Thread_140182 9395 _dispatch_sig_thread (in libdispatch.dylib) 9395 _dispatch_sigsuspend (in libdispatch.dylib) 9395 __sigsuspend_nocancel (in libsystem_kernel.dylib)
There’s no way to tell that “Daemon” is blocking process “A” and “B”.
Process A !9395 Thread_140181 9395 _dispatch_mgr_thread (in libdispatch.dylib) 9395 _dispatch_mgr_invoke (in libdispatch.dylib) 9395 kevent64 (in libsystem_kernel.dylib) !9395 Thread_140182 9395 _dispatch_sig_thread (in libdispatch.dylib) 9395 _dispatch_sigsuspend (in libdispatch.dylib) 9395 __sigsuspend_nocancel (in libsystem_kernel.dylib)
Process B !9395 Thread_140181 9395 _dispatch_mgr_thread (in libdispatch.dylib) 9395 _dispatch_mgr_invoke (in libdispatch.dylib) 9395 kevent64 (in libsystem_kernel.dylib) !9395 Thread_140182 9395 _dispatch_sig_thread (in libdispatch.dylib) 9395 _dispatch_sigsuspend (in libdispatch.dylib) 9395 __sigsuspend_nocancel (in libsystem_kernel.dylib
![Page 19: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/19.jpg)
Debugging Challenges
![Page 20: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/20.jpg)
Debugging Challenges
![Page 21: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/21.jpg)
Complexity of the OS
Application opendirectoryd
gssd securityd
![Page 22: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/22.jpg)
Complexity of the OS
Application opendirectoryd
gssd securityd
![Page 23: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/23.jpg)
Program
Complex Crashes
Tim
e
![Page 24: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/24.jpg)
Program
Complex Crashes
menu select
key equiv
menu select
button click
Daemon
XPCService Daemon
menu select
XPCService
Tim
e
![Page 25: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/25.jpg)
Program
Complex Crashes
menu select
key equiv
menu select
button click
Daemon
Daemon
menu select
XPCService
Tim
e
Your query cannot be completed at
this time!
![Page 26: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/26.jpg)
Goals
![Page 27: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/27.jpg)
Goals
Include additional data in diagnostic reports
![Page 28: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/28.jpg)
Goals
Include additional data in diagnostic reports
Reduce the time “guessing” what, where, and when
![Page 29: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/29.jpg)
Goals
Include additional data in diagnostic reports
Reduce the time “guessing” what, where, and when
Understand interaction of actions over time
![Page 30: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/30.jpg)
Goals
Include additional data in diagnostic reports
Reduce the time “guessing” what, where, and when
Understand interaction of actions over time
Lightweight and easy to use
![Page 31: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/31.jpg)
Improving Crash ReportsCrashed Thread: 0 Dispatch queue: com.apple.main-thread !Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 !Breadcrumb Trail (reverse chronological seconds): 6 Query directory using NSRunLoop (Activity ID: 0x0000008f00000002) 15 Query directory using NSRunLoop !Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.Query-Directory 0x00000001000027ea -[QDAppDelegate query:foundResults:error:] + 554 1 com.apple.OpenDirectory 0x00007fff9066ec88 __delegate_callback + 388 2 com.apple.CFOpenDirectory 0x00007fff84750bed _query_perform + 568 3 com.apple.CoreFoundation 0x00007fff8964e1f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 • • • 16 com.apple.AppKit 0x00007fff83c01a9e NSApplicationMain + 1778 17 com.apple.Query-Directory 0x0000000100001a82 main + 34 18 libdyld.dylib 0x00007fff874af5c9 start + 1 !Activity ID: 0x0000008f00000002 Activity Name: sendAction: Activity Breadcrumb: Query directory using NSRunLoop Activity Running Time: 6.028601 sec Activity Failure Reason: none detected !Trace Messages (reverse chronological seconds): 5.866399 Query Directory 0x0000000100000000 IPC send
Additional info about key events leading up to crash
Detailed messages associated with the crash point
![Page 32: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/32.jpg)
OS X PerformanceM
icro
seco
nds
35
70
105
140
MacPro 2008 MacBookPro 15" Late 2013 iMac 27”
6 10 15
41
62
87
62
75
137 NSLogsyslogActivity tracing
![Page 33: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/33.jpg)
iOS PerformanceM
icro
seco
nds
450
900
1350
1800
iPhone 4s iPhone 5c iPad Air
2 2 6
309 291
539
1225 1109
1732 NSLogsyslogActivity tracing
![Page 34: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/34.jpg)
Program
Terminology
Daemon
Daemon
XPCService
XPCService
Tim
e
![Page 35: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/35.jpg)
Program
Terminology
Daemon
Daemon
XPCService
XPCService
menu select
key equiv
menu select
button click
menu select
Activity
Tim
e
![Page 36: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/36.jpg)
Program
Terminology
Daemon
Daemon
XPCService
XPCService
menu select
key equiv
menu select
button click
menu select
Activity
Breadcrumb
Tim
e
Compose mail
Send mail
![Page 37: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/37.jpg)
Program
Terminology
Daemon
Daemon
XPCService
XPCService
menu select
key equiv
menu select
button click
menu select
Activity
Breadcrumb
Trace messages
Tim
e
Compose mail
Send mail
![Page 38: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/38.jpg)
Program
Terminology
Daemon
Daemon
XPCService
XPCService
menu select
key equiv
menu select
button click
menu select
Activity
Breadcrumb
Trace messages
diagnosticd
Tim
e
Compose mail
Send mail
![Page 39: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/39.jpg)
Activities
![Page 40: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/40.jpg)
What is an Activity?
![Page 41: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/41.jpg)
What is an Activity?
Set of work triggered by an action
securityd
gssd
opendirectoryd
Application
![Page 42: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/42.jpg)
What is an Activity?
Set of work triggered by an action
Explicitly defined set of work
securityd
gssd
opendirectoryd
Application
![Page 43: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/43.jpg)
System Activity
![Page 44: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/44.jpg)
System Activity
System generated 64-bit identifier (AID)
![Page 45: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/45.jpg)
System Activity
System generated 64-bit identifier (AID)
Autopropagated by the system
![Page 46: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/46.jpg)
Process A
Process B
System Activity
System generated 64-bit identifier (AID)
Autopropagated by the system
![Page 47: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/47.jpg)
Process A
Process B
System Activity
System generated 64-bit identifier (AID)
Autopropagated by the system Q1
AID: 1
Q2
AID: 2
Q3
AID: 1
Q1
AID: 1
Q2
AID: 1
Q3
AID: 2
![Page 48: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/48.jpg)
Activities Over Time
Program XPCService
Daemon
Daemon
XPCService
Tim
e
![Page 49: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/49.jpg)
Activities Over Time
Program XPCService
menu select (AID: 4)
key equiv (AID: 3)
Daemon
menu select (AID: 1)
button click (AID: 5)
(AID: 5)
(AID: 1)
Daemon
(AID: 5)
menu select (AID: 2)
XPCService
(AID: 3)
Activity
Tim
e
![Page 50: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/50.jpg)
Activity Creation
![Page 51: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/51.jpg)
Activity Creation
Automatically generated by UIKit and AppKit for UI actions
![Page 52: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/52.jpg)
Activity Creation
Automatically generated by UIKit and AppKit for UI actions
Explicitly created activities
![Page 53: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/53.jpg)
Q1 Q2 Q3
Activity Creation
Automatically generated by UIKit and AppKit for UI actions
Explicitly created activities
Detached activities
![Page 54: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/54.jpg)
Q1 Q2 Q3
Activity Creation
Automatically generated by UIKit and AppKit for UI actions
Explicitly created activities
Detached activities
AID: 1 AID: 1
![Page 55: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/55.jpg)
Q1 Q2 Q3
Activity Creation
Automatically generated by UIKit and AppKit for UI actions
Explicitly created activities
Detached activities
AID: 1 AID: 2 AID: 1
![Page 56: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/56.jpg)
Initiating Activities
![Page 57: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/57.jpg)
Initiating Activities
os_activity_initiate(“Activity Name”, flags, ^{ });
![Page 58: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/58.jpg)
Initiating Activities
os_activity_initiate(“Activity Name”, flags, ^{ });
• Activity name must be a constant string
![Page 59: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/59.jpg)
Initiating Activities
os_activity_initiate(“Activity Name”, flags, ^{ });
• Activity name must be a constant string
• Optional flags to control behavior
![Page 60: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/60.jpg)
Initiating Activities
os_activity_initiate(“Activity Name”, flags, ^{ });
• Activity name must be a constant string
• Optional flags to control behavior
• Non block variants available
![Page 61: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/61.jpg)
Initiating Activities
os_activity_initiate(“Activity Name”, flags, ^{ });
• Activity name must be a constant string
• Optional flags to control behavior
• Non block variants available
#include <os/activity.h>
![Page 62: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/62.jpg)
Automatically Generated Activities
Process AppKit / UIKit Process Callback
![Page 63: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/63.jpg)
Automatically Generated Activities
Process AppKit / UIKit Process Callback
os_activity_start();
![Page 64: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/64.jpg)
Automatically Generated Activities
- (IBAction)searchField:(id)sender { results = [self searchString: searchValue]; ••• }
Process AppKit / UIKit Process Callback
os_activity_start();
![Page 65: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/65.jpg)
Automatically Generated Activities
- (IBAction)searchField:(id)sender { results = [self searchString: searchValue]; ••• }
Process AppKit / UIKit Process Callback
os_activity_start();
os_activity_stop();
![Page 66: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/66.jpg)
Explicitly Create Activities
#include <os/activity.h> !
- (void)checkCaches { if (!verify) { /* a lot of work is done during initialization */ os_activity_initiate(“verifying cache”, OS_ACTIVITY_FLAG_DEFAULT, ^{ • • • }); } }
![Page 67: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/67.jpg)
Explicitly Create Activities
#include <os/activity.h> !
- (void)checkCaches { if (!verify) { /* a lot of work is done during initialization */ os_activity_initiate(“verifying cache”, OS_ACTIVITY_FLAG_DEFAULT, ^{ • • • }); } }
![Page 68: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/68.jpg)
Detached Activity
#include <os/activity.h> !
- (IBAction) searchField:(id)sender { /* will be called with an activity already created */ if (async_reindex) { os_activity_initiate(“reindex”, OS_ACTIVITY_FLAG_DETACHED, ^{ /* issue re-index work detached from current activity */ • • • }); } !
/* issue lookup based on original request */ }
![Page 69: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/69.jpg)
Detached Activity
#include <os/activity.h> !
- (IBAction) searchField:(id)sender { /* will be called with an activity already created */ if (async_reindex) { os_activity_initiate(“reindex”, OS_ACTIVITY_FLAG_DETACHED, ^{ /* issue re-index work detached from current activity */ • • • }); } !
/* issue lookup based on original request */ }
![Page 70: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/70.jpg)
Breadcrumbs
![Page 71: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/71.jpg)
Breadcrumbs
![Page 72: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/72.jpg)
Breadcrumbs
Label meaningful activities
![Page 73: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/73.jpg)
Breadcrumbs
Label meaningful activities
Macrolevel interactions over time
![Page 74: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/74.jpg)
Breadcrumbs
Label meaningful activities
Macrolevel interactions over timeSend mail
Compose mailMenu select
Button click
Menu select
Key equivalent
Menu select
![Page 75: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/75.jpg)
Breadcrumbs
Label meaningful activities
Macrolevel interactions over timeSend mail
Compose mail Menu select
Button click
Menu select
Key equivalent
Menu select
![Page 76: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/76.jpg)
Breadcrumb DiagramTi
me
Program XPCService
menu select (AID: 4)
key equivalent (AID: 3)
Daemonmenu select
(AID: 1)
button click (AID: 5)
(AID: 5)
(AID: 1)
Daemon
(AID: 5)
menu select(AID: 2)
XPCService
(AID: 3)
Activity
![Page 77: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/77.jpg)
Breadcrumb DiagramTi
me
Program XPCService
menu select (AID: 4)
key equivalent (AID: 3)
Daemonmenu select
(AID: 1)
button click (AID: 5)
(AID: 5)
(AID: 1)
Daemon
(AID: 5)
menu select(AID: 2)
XPCService
(AID: 3)
ActivityCompose mail
Send mail
Breadcrumb
![Page 78: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/78.jpg)
Adding a Breadcrumb
![Page 79: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/79.jpg)
Adding a Breadcrumb
os_activity_set_breadcrumb(“composing mail”);
![Page 80: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/80.jpg)
Adding a Breadcrumb
os_activity_set_breadcrumb(“composing mail”);
• Only supported by main process binary
![Page 81: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/81.jpg)
Adding a Breadcrumb
os_activity_set_breadcrumb(“composing mail”);
• Only supported by main process binary
• Cannot be done from libraries, plugins, etc.
![Page 82: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/82.jpg)
Adding a Breadcrumb
os_activity_set_breadcrumb(“composing mail”);
• Only supported by main process binary
• Cannot be done from libraries, plugins, etc.
• Constant string must be provided
![Page 83: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/83.jpg)
Adding a Breadcrumb
os_activity_set_breadcrumb(“composing mail”);
• Only supported by main process binary
• Cannot be done from libraries, plugins, etc.
• Constant string must be provided
#include <os/activity.h>
![Page 84: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/84.jpg)
Breadcrumb Example
#include <os/activity.h> !
- (IBAction)searchField:(id)sender { if (useCache) { os_activity_set_breadcrumb(“searching cache”); db = [self _cache]; } else { os_activity_set_breadcrumb(“searching database”); db = [self _database]; } [db search:sender]; }
![Page 85: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/85.jpg)
Breadcrumb Example
#include <os/activity.h> !
- (IBAction)searchField:(id)sender { if (useCache) { os_activity_set_breadcrumb(“searching cache”); db = [self _cache]; } else { os_activity_set_breadcrumb(“searching database”); db = [self _database]; } [db search:sender]; }
![Page 86: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/86.jpg)
Breadcrumb Example
#include <os/activity.h> !
- (IBAction)searchField:(id)sender { if (useCache) { os_activity_set_breadcrumb(“searching cache”); db = [self _cache]; } else { os_activity_set_breadcrumb(“searching database”); db = [self _database]; } [db search:sender]; }
![Page 87: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/87.jpg)
Trace Messages
![Page 88: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/88.jpg)
Trace Messages
![Page 89: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/89.jpg)
Trace Messages
New API to add trace messages to an activity
![Page 90: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/90.jpg)
Trace Messages
New API to add trace messages to an activity
Uses standard printf-style format strings
![Page 91: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/91.jpg)
Trace Messages
New API to add trace messages to an activity
Uses standard printf-style format strings
Lightweight
![Page 92: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/92.jpg)
Trace Messages
New API to add trace messages to an activity
Uses standard printf-style format strings
Lightweight
Adjustable behavior
![Page 93: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/93.jpg)
Trace Messages
New API to add trace messages to an activity
Uses standard printf-style format strings
Lightweight
Adjustable behavior
Stored in an in-memory ring buffer
![Page 94: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/94.jpg)
Trace Messages
New API to add trace messages to an activity
Uses standard printf-style format strings
Lightweight
Adjustable behavior
Stored in an in-memory ring buffer
PC Timestamp String Offset Data1 Data2 • • • (64-bytes)
PC Timestamp String Offset Data1 Data2 • • •
PC Timestamp String Offset Data1 Data2 • • •
PC Timestamp String Offset Data1 Data2 • • •
![Page 95: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/95.jpg)
Trace Message
![Page 96: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/96.jpg)
Trace Message
os_trace(“Interface %ld state %d”, ifindex, state);
![Page 97: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/97.jpg)
Trace Message
os_trace(“Interface %ld state %d”, ifindex, state);
• Supports printf-style format strings
![Page 98: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/98.jpg)
Trace Message
os_trace(“Interface %ld state %d”, ifindex, state);
• Supports printf-style format strings
• Only scalar format types
![Page 99: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/99.jpg)
Trace Message
os_trace(“Interface %ld state %d”, ifindex, state);
• Supports printf-style format strings
• Only scalar format types
• Strings and characters are not supported for privacy, performance, and security
![Page 100: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/100.jpg)
Trace Message
os_trace(“Interface %ld state %d”, ifindex, state);
• Supports printf-style format strings
• Only scalar format types
• Strings and characters are not supported for privacy, performance, and security
#include <os/trace.h>
![Page 101: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/101.jpg)
Debug Trace Message
![Page 102: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/102.jpg)
Debug Trace Message
os_trace_debug(“Open socket %d total time %2.3f ms”, sock, ttime);
![Page 103: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/103.jpg)
Debug Trace Message
os_trace_debug(“Open socket %d total time %2.3f ms”, sock, ttime);
• Only saved to ring buffer under debug mode
![Page 104: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/104.jpg)
Debug Trace Message
os_trace_debug(“Open socket %d total time %2.3f ms”, sock, ttime);
• Only saved to ring buffer under debug mode
• Additional resources used if debug mode is enabled
![Page 105: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/105.jpg)
Debug Trace Message
os_trace_debug(“Open socket %d total time %2.3f ms”, sock, ttime);
• Only saved to ring buffer under debug mode
• Additional resources used if debug mode is enabled
• Setting environment variable will enable debug at launch
![Page 106: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/106.jpg)
Debug Trace Message
os_trace_debug(“Open socket %d total time %2.3f ms”, sock, ttime);
• Only saved to ring buffer under debug mode
• Additional resources used if debug mode is enabled
• Setting environment variable will enable debug at launch OS_ACTIVITY_MODE=debug
![Page 107: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/107.jpg)
Payload Trace Message
![Page 108: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/108.jpg)
Payload Trace Message
os_trace_with_payload(“Interface: %ld”, ifindex, ^(xpc_object_t xdict) { xpc_dictionary_set_string(xdict, “ifname”, ifname); });
![Page 109: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/109.jpg)
Payload Trace Message
os_trace_with_payload(“Interface: %ld”, ifindex, ^(xpc_object_t xdict) { xpc_dictionary_set_string(xdict, “ifname”, ifname); });
• Block is only called if tools have enabled stream mode
![Page 110: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/110.jpg)
Payload Trace Message
os_trace_with_payload(“Interface: %ld”, ifindex, ^(xpc_object_t xdict) { xpc_dictionary_set_string(xdict, “ifname”, ifname); });
• Block is only called if tools have enabled stream mode
• Uses XPC to deliver message to diagnosticd
![Page 111: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/111.jpg)
Payload Trace Message
os_trace_with_payload(“Interface: %ld”, ifindex, ^(xpc_object_t xdict) { xpc_dictionary_set_string(xdict, “ifname”, ifname); });
• Block is only called if tools have enabled stream mode
• Uses XPC to deliver message to diagnosticd
• Setting environment variable will enable stream mode at launch
![Page 112: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/112.jpg)
Payload Trace Message
os_trace_with_payload(“Interface: %ld”, ifindex, ^(xpc_object_t xdict) { xpc_dictionary_set_string(xdict, “ifname”, ifname); });
• Block is only called if tools have enabled stream mode
• Uses XPC to deliver message to diagnosticd
• Setting environment variable will enable stream mode at launch OS_ACTIVITY_MODE=stream
![Page 113: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/113.jpg)
Tim
e
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
ActivityCompose mail
Send mail
Breadcrumb
Trace Messages
![Page 114: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/114.jpg)
Tim
e
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
ActivityCompose mail
Send mail
Breadcrumb
Trace Messages
Trace messages
![Page 115: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/115.jpg)
Sample CrashCrashed Thread: 0 Dispatch queue: com.apple.main-thread !Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 !Breadcrumb Trail (reverse chronological seconds): 6 Query directory using NSRunLoop (Activity ID: 0x0000008f00000002) 15 Query directory using NSRunLoop !Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.Query-Directory 0x00000001000027ea -[QDAppDelegate query:foundResults:error:] + 554 1 com.apple.OpenDirectory 0x00007fff9066ec88 __delegate_callback + 388 2 com.apple.CFOpenDirectory 0x00007fff84750bed _query_perform + 568 3 com.apple.CoreFoundation 0x00007fff8964e1f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 • • • 16 com.apple.AppKit 0x00007fff83c01a9e NSApplicationMain + 1778 17 com.apple.Query-Directory 0x0000000100001a82 main + 34 18 libdyld.dylib 0x00007fff874af5c9 start + 1 !Activity ID: 0x0000008f00000002 Activity Name: sendAction: Activity Breadcrumb: Query directory using NSRunLoop Activity Running Time: 6.028601 sec Activity Failure Reason: none detected !Trace Messages (reverse chronological seconds): 5.866399 Query Directory 0x0000000100000000 IPC send 5.866463 Query Directory 0x00000001000027e0 aborting test due to no results 5.866529 Query Directory 0x0000000100000000 IPC send 5.866564 Query Directory 0x0000000100002243 skipping record with UID 210 (not member of 'admin') 5.866583 opendirectoryd 0xffffffff00000000 IPC send 5.866596 opendirectoryd 0xffffffff00021c21 request completed, delivered 1 results • • • 5.866803 opendirectoryd 0xffffffff00021640 UID: 4129, EUID: 4129, GID: 11, EGID: 11 5.866863 opendirectoryd 0xffffffff00000000 IPC receive 5.866883 Query Directory 0x0000000100000000 IPC send
Additional info about key events leading up to crash
Detailed messages associated with the crash point
![Page 116: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/116.jpg)
Sample CrashCrashed Thread: 0 Dispatch queue: com.apple.main-thread !Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 !Breadcrumb Trail (reverse chronological seconds): 6 Query directory using NSRunLoop (Activity ID: 0x0000008f00000002) 15 Query directory using NSRunLoop !Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.Query-Directory 0x00000001000027ea -[QDAppDelegate query:foundResults:error:] + 554 1 com.apple.OpenDirectory 0x00007fff9066ec88 __delegate_callback + 388 2 com.apple.CFOpenDirectory 0x00007fff84750bed _query_perform + 568 3 com.apple.CoreFoundation 0x00007fff8964e1f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 • • • 16 com.apple.AppKit 0x00007fff83c01a9e NSApplicationMain + 1778 17 com.apple.Query-Directory 0x0000000100001a82 main + 34 18 libdyld.dylib 0x00007fff874af5c9 start + 1 !Activity ID: 0x0000008f00000002 Activity Name: sendAction: Activity Breadcrumb: Query directory using NSRunLoop Activity Running Time: 6.028601 sec Activity Failure Reason: none detected !Trace Messages (reverse chronological seconds): 5.866399 Query Directory 0x0000000100000000 IPC send 5.866463 Query Directory 0x00000001000027e0 aborting test due to no results 5.866529 Query Directory 0x0000000100000000 IPC send 5.866564 Query Directory 0x0000000100002243 skipping record with UID 210 (not member of 'admin') 5.866583 opendirectoryd 0xffffffff00000000 IPC send 5.866596 opendirectoryd 0xffffffff00021c21 request completed, delivered 1 results • • • 5.866803 opendirectoryd 0xffffffff00021640 UID: 4129, EUID: 4129, GID: 11, EGID: 11 5.866863 opendirectoryd 0xffffffff00000000 IPC receive 5.866883 Query Directory 0x0000000100000000 IPC send
Breadcrumb Trail (reverse chronological seconds): 6 Query directory using NSRunLoop (Activity ID: 0x0000008f00000002) 15 Query directory using NSRunLoop
![Page 117: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/117.jpg)
Sample CrashCrashed Thread: 0 Dispatch queue: com.apple.main-thread !Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 !Breadcrumb Trail (reverse chronological seconds): 6 Query directory using NSRunLoop (Activity ID: 0x0000008f00000002) 15 Query directory using NSRunLoop !Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.Query-Directory 0x00000001000027ea -[QDAppDelegate query:foundResults:error:] + 554 1 com.apple.OpenDirectory 0x00007fff9066ec88 __delegate_callback + 388 2 com.apple.CFOpenDirectory 0x00007fff84750bed _query_perform + 568 3 com.apple.CoreFoundation 0x00007fff8964e1f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 • • • 16 com.apple.AppKit 0x00007fff83c01a9e NSApplicationMain + 1778 17 com.apple.Query-Directory 0x0000000100001a82 main + 34 18 libdyld.dylib 0x00007fff874af5c9 start + 1 !Activity ID: 0x0000008f00000002 Activity Name: sendAction: Activity Breadcrumb: Query directory using NSRunLoop Activity Running Time: 6.028601 sec Activity Failure Reason: none detected !Trace Messages (reverse chronological seconds): 5.866399 Query Directory 0x0000000100000000 IPC send 5.866463 Query Directory 0x00000001000027e0 aborting test due to no results 5.866529 Query Directory 0x0000000100000000 IPC send 5.866564 Query Directory 0x0000000100002243 skipping record with UID 210 (not member of 'admin') 5.866583 opendirectoryd 0xffffffff00000000 IPC send 5.866596 opendirectoryd 0xffffffff00021c21 request completed, delivered 1 results • • • 5.866803 opendirectoryd 0xffffffff00021640 UID: 4129, EUID: 4129, GID: 11, EGID: 11 5.866863 opendirectoryd 0xffffffff00000000 IPC receive 5.866883 Query Directory 0x0000000100000000 IPC send
Activity ID: 0x0000008f00000002 Activity Name: sendAction: Activity Breadcrumb: Query directory using NSRunLoop Activity Running Time: 6.028601 sec Activity Failure Reason: none detected
![Page 118: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/118.jpg)
Sample CrashCrashed Thread: 0 Dispatch queue: com.apple.main-thread !Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 !Breadcrumb Trail (reverse chronological seconds): 6 Query directory using NSRunLoop (Activity ID: 0x0000008f00000002) 15 Query directory using NSRunLoop !Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.Query-Directory 0x00000001000027ea -[QDAppDelegate query:foundResults:error:] + 554 1 com.apple.OpenDirectory 0x00007fff9066ec88 __delegate_callback + 388 2 com.apple.CFOpenDirectory 0x00007fff84750bed _query_perform + 568 3 com.apple.CoreFoundation 0x00007fff8964e1f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 • • • 16 com.apple.AppKit 0x00007fff83c01a9e NSApplicationMain + 1778 17 com.apple.Query-Directory 0x0000000100001a82 main + 34 18 libdyld.dylib 0x00007fff874af5c9 start + 1 !Activity ID: 0x0000008f00000002 Activity Name: sendAction: Activity Breadcrumb: Query directory using NSRunLoop Activity Running Time: 6.028601 sec Activity Failure Reason: none detected !Trace Messages (reverse chronological seconds): 5.866399 Query Directory 0x0000000100000000 IPC send 5.866463 Query Directory 0x00000001000027e0 aborting test due to no results 5.866529 Query Directory 0x0000000100000000 IPC send 5.866564 Query Directory 0x0000000100002243 skipping record with UID 210 (not member of 'admin') 5.866583 opendirectoryd 0xffffffff00000000 IPC send 5.866596 opendirectoryd 0xffffffff00021c21 request completed, delivered 1 results • • • 5.866803 opendirectoryd 0xffffffff00021640 UID: 4129, EUID: 4129, GID: 11, EGID: 11 5.866863 opendirectoryd 0xffffffff00000000 IPC receive 5.866883 Query Directory 0x0000000100000000 IPC send
Trace Messages (reverse chronological seconds): 5.866399 Query Directory 0x0000000100000000 IPC send 5.866463 Query Directory 0x00000001000027e0 aborting test due to no results 5.866529 Query Directory 0x0000000100000000 IPC send 5.866564 Query Directory 0x0000000100002243 skipping record with UID 210 (not member of 'admin') 5.866583 opendirectoryd 0xffffffff00000000 IPC send 5.866596 opendirectoryd 0xffffffff00021c21 request completed, delivered 1 results • • • 5.866803 opendirectoryd 0xffffffff00021640 UID: 4129, EUID: 4129, GID: 11, EGID: 11 5.866863 opendirectoryd 0xffffffff00000000 IPC receive 5.866883 Query Directory 0x0000000100000000 IPC send
![Page 119: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/119.jpg)
Tim
e
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Crashing Process
Activity
Breadcrumb
Trace messages
![Page 120: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/120.jpg)
Tim
e
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Crashing Process
Activity
Breadcrumb
Trace messages
![Page 121: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/121.jpg)
diagnosticd
Send mail
button click
Compose mail
Tim
e
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Crashing Process
Activity
Breadcrumb
Trace messages
![Page 122: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/122.jpg)
Reporting Unexpected Errors
![Page 123: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/123.jpg)
Reporting Unexpected Errors
os_trace_error(“Interface %ld failed error %d”, ifindex, errno);
![Page 124: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/124.jpg)
Reporting Unexpected Errors
os_trace_error(“Interface %ld failed error %d”, ifindex, errno);
• Signals that an error occurred
![Page 125: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/125.jpg)
Reporting Unexpected Errors
os_trace_error(“Interface %ld failed error %d”, ifindex, errno);
• Signals that an error occurred
• Trace messages are sent to diagnosticd
![Page 126: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/126.jpg)
Reporting Fatal Errors
![Page 127: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/127.jpg)
Reporting Fatal Errors
os_trace_fault(“invalid state %d - will likely crash”, state);
![Page 128: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/128.jpg)
Reporting Fatal Errors
os_trace_fault(“invalid state %d - will likely crash”, state);
• Could be impending catastrophic failure (assert, abort, or crash)
![Page 129: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/129.jpg)
Reporting Fatal Errors
os_trace_fault(“invalid state %d - will likely crash”, state);
• Could be impending catastrophic failure (assert, abort, or crash)
• Trace messages from all involved processes sent to diagnosticd
![Page 130: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/130.jpg)
Utilizing FaultsTi
me
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Activity
Breadcrumb
Trace messages
![Page 131: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/131.jpg)
Utilizing Faults
diagnosticd
Send mail
button click
Compose mail
Tim
e
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Activity
Breadcrumb
Trace messages
![Page 132: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/132.jpg)
Example Fault
#include <os/trace.h> #include <os/activity.h> !
int main(int argc, char *argv[]) { os_activity_initiate(“startup initialization”, 0, ^{ os_trace_debug(“passed %d args”, argc); if (!_do_initialization(argc, argv)) { os_trace_fault(“failed to initialize %d”, errno); errx(EX_SOFTWARE, “failed to initialize”); } }); }
![Page 133: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/133.jpg)
Example Fault
#include <os/trace.h> #include <os/activity.h> !
int main(int argc, char *argv[]) { os_activity_initiate(“startup initialization”, 0, ^{ os_trace_debug(“passed %d args”, argc); if (!_do_initialization(argc, argv)) { os_trace_fault(“failed to initialize %d”, errno); errx(EX_SOFTWARE, “failed to initialize”); } }); }
![Page 134: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/134.jpg)
Supported Trace Messages
![Page 135: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/135.jpg)
Supported Trace Messages
os_trace(“Running as UID: %d, GID: %d”, geteuid(), getegid());“Running as UID: 501, GID: 20”
![Page 136: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/136.jpg)
Supported Trace Messages
os_trace(“Running as UID: %d, GID: %d”, geteuid(), getegid());“Running as UID: 501, GID: 20”os_trace(“Initialization phase - state: %d, flags: %ld”, state, flags);“Initialization phase - state: 32, flags: 2328”
![Page 137: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/137.jpg)
Supported Trace Messages
os_trace(“Running as UID: %d, GID: %d”, geteuid(), getegid());“Running as UID: 501, GID: 20”os_trace(“Initialization phase - state: %d, flags: %ld”, state, flags);“Initialization phase - state: 32, flags: 2328”
os_trace(“New client connection: %p, idle-disconnect: %d”, connection, idle);“New client connection: 0x23211382, idle-disconnect: 30”
![Page 138: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/138.jpg)
Supported Trace Messages
os_trace(“Running as UID: %d, GID: %d”, geteuid(), getegid());“Running as UID: 501, GID: 20”os_trace(“Initialization phase - state: %d, flags: %ld”, state, flags);“Initialization phase - state: 32, flags: 2328”
os_trace(“New client connection: %p, idle-disconnect: %d”, connection, idle);“New client connection: 0x23211382, idle-disconnect: 30”
os_trace(“Clients active: %d, average: %2.3f seconds”, count, avg);“Client max: 30, average: 35.253 seconds”
![Page 139: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/139.jpg)
Unsupported Trace Messages
![Page 140: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/140.jpg)
Unsupported Trace Messages
os_trace(“Logged in as user %s on host %s”, username, hostname);“Logged in as user UNSUPPORTED_STRING on host UNSUPPORTED_STRING”
![Page 141: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/141.jpg)
Unsupported Trace Messages
os_trace(“Logged in as user %s on host %s”, username, hostname);“Logged in as user UNSUPPORTED_STRING on host UNSUPPORTED_STRING”os_trace(“Logged in as UID %d, password: %s”, geteuid(), password);“Logged in as UID 501, password: UNSUPPORTED_STRING”
![Page 142: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/142.jpg)
Unsupported Trace Messages
os_trace(“Logged in as user %s on host %s”, username, hostname);“Logged in as user UNSUPPORTED_STRING on host UNSUPPORTED_STRING”os_trace(“Logged in as UID %d, password: %s”, geteuid(), password);“Logged in as UID 501, password: UNSUPPORTED_STRING”os_trace(“Logged in using initial %c”, initial[0]);“Logged in using initial UNSUPPORTED_CHAR”
![Page 143: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/143.jpg)
There are Limits
![Page 144: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/144.jpg)
There are Limits
The format string cannot exceed 100 characters
![Page 145: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/145.jpg)
There are Limits
The format string cannot exceed 100 characters
Trace message content has a limit and will truncate if exceeded
![Page 146: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/146.jpg)
There are Limits
The format string cannot exceed 100 characters
Trace message content has a limit and will truncate if exceeded• os_trace API will accept a maximum of 7 scalar values
![Page 147: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/147.jpg)
There are Limits
The format string cannot exceed 100 characters
Trace message content has a limit and will truncate if exceeded• os_trace API will accept a maximum of 7 scalar values
Trace message buffer size may vary by platform and mode
![Page 148: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/148.jpg)
DemoCrash reports
![Page 149: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/149.jpg)
Debugger Support
![Page 150: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/150.jpg)
Debugger Support
Current activity running on thread
![Page 151: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/151.jpg)
Debugger Support
Current activity running on thread
Trace messages for thread with an activity
![Page 152: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/152.jpg)
Using lldb
(lldb) thread info thread #1: tid = 0x1c93, 0x00007fff9452a37a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', activity = 'sendAction:', 5 messages, stop reason = signal SIGABRT
Activity 'sendAction:', 0x4d00000002 Current Breadcrumb: Query directory using NSRunLoop 5 trace messages: aborting test due to no resultsskipping record with UID 210 (not member of 'admin')IPC send issued querycanceling previous query for mode: 0
![Page 153: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/153.jpg)
Using lldb
(lldb) thread info thread #1: tid = 0x1c93, 0x00007fff9452a37a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', activity = 'sendAction:', 5 messages, stop reason = signal SIGABRT
Activity 'sendAction:', 0x4d00000002 Current Breadcrumb: Query directory using NSRunLoop 5 trace messages: aborting test due to no resultsskipping record with UID 210 (not member of 'admin')IPC send issued querycanceling previous query for mode: 0
![Page 154: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/154.jpg)
Using lldb
(lldb) thread info thread #1: tid = 0x1c93, 0x00007fff9452a37a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', activity = 'sendAction:', 5 messages, stop reason = signal SIGABRT
Activity 'sendAction:', 0x4d00000002 Current Breadcrumb: Query directory using NSRunLoop 5 trace messages: aborting test due to no resultsskipping record with UID 210 (not member of 'admin')IPC send issued querycanceling previous query for mode: 0
![Page 155: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/155.jpg)
DemoXcode
![Page 156: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/156.jpg)
Tools
![Page 157: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/157.jpg)
ostraceutil
![Page 158: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/158.jpg)
ostraceutil
Live streaming by process name or pid
![Page 159: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/159.jpg)
ostraceutil
Live streaming by process name or pid
Watch for faults and errors
![Page 160: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/160.jpg)
ostraceutil
Live streaming by process name or pid
Watch for faults and errors
Inspect binaries for various activity tracing strings
![Page 161: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/161.jpg)
Live StreamingLive Streaming[~] root% ostraceutil -watch -process Query\ Directory PID: 640 Timestamp: 1141.218854 RELEASE Activity ID: 0x0000007100000001 Trace ID: 0x00000100000047c7 Thread: 0x32a9 Image UUID: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image Path: /Demos/Query Directory.app/Contents/MacOS/Query Directory Offset: 0x30a7 Message: 'issued query' Payload: '<dictionary: 0x7fe7331004b0> { count = 1, contents = "queryString" => <string: 0x7fe733100580> { length = 1, contents = "z" } }' ---------------------- Timestamp: 0.000000 DEBUG Trace ID: 0x0000020000004a30 Offset: 0x291f Message: 'query results received 1 more results' ---------------------- Timestamp: 1141.252109 RELEASE Trace ID: 0x00000100000046c0 Offset: 0x2243 Message: 'skipping record with UID 210 (not member of 'admin')' Payload: '<dictionary: 0x7fe730404800> { count = 2, contents = "full name" => <string: 0x7fe730403dd0> { length = 18, contents = "AutoTimeZoneDaemon" } "name" => <string: 0x7fe730404910> { length = 9, contents = "_timezone" } }'
![Page 162: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/162.jpg)
Live StreamingLive Streaming[~] root% ostraceutil -watch -process Query\ Directory PID: 640 Timestamp: 1141.218854 RELEASE Activity ID: 0x0000007100000001 Trace ID: 0x00000100000047c7 Thread: 0x32a9 Image UUID: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image Path: /Demos/Query Directory.app/Contents/MacOS/Query Directory Offset: 0x30a7 Message: 'issued query' Payload: '<dictionary: 0x7fe7331004b0> { count = 1, contents = "queryString" => <string: 0x7fe733100580> { length = 1, contents = "z" } }' ---------------------- Timestamp: 0.000000 DEBUG Trace ID: 0x0000020000004a30 Offset: 0x291f Message: 'query results received 1 more results' ---------------------- Timestamp: 1141.252109 RELEASE Trace ID: 0x00000100000046c0 Offset: 0x2243 Message: 'skipping record with UID 210 (not member of 'admin')' Payload: '<dictionary: 0x7fe730404800> { count = 2, contents = "full name" => <string: 0x7fe730403dd0> { length = 18, contents = "AutoTimeZoneDaemon" } "name" => <string: 0x7fe730404910> { length = 9, contents = "_timezone" } }'
[~] root% ostraceutil -watch -process Query\ Directory
![Page 163: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/163.jpg)
Live StreamingLive Streaming[~] root% ostraceutil -watch -process Query\ Directory PID: 640 Timestamp: 1141.218854 RELEASE Activity ID: 0x0000007100000001 Trace ID: 0x00000100000047c7 Thread: 0x32a9 Image UUID: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image Path: /Demos/Query Directory.app/Contents/MacOS/Query Directory Offset: 0x30a7 Message: 'issued query' Payload: '<dictionary: 0x7fe7331004b0> { count = 1, contents = "queryString" => <string: 0x7fe733100580> { length = 1, contents = "z" } }' ---------------------- Timestamp: 0.000000 DEBUG Trace ID: 0x0000020000004a30 Offset: 0x291f Message: 'query results received 1 more results' ---------------------- Timestamp: 1141.252109 RELEASE Trace ID: 0x00000100000046c0 Offset: 0x2243 Message: 'skipping record with UID 210 (not member of 'admin')' Payload: '<dictionary: 0x7fe730404800> { count = 2, contents = "full name" => <string: 0x7fe730403dd0> { length = 18, contents = "AutoTimeZoneDaemon" } "name" => <string: 0x7fe730404910> { length = 9, contents = "_timezone" } }'
Payload: '<dictionary: 0x7fe7331004b0> { count = 1, contents = "queryString" => <string: 0x7fe733100580> { length = 1, contents = "z" } }'
![Page 164: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/164.jpg)
Watching Faults[~] root% ostraceutil -watch -faults Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory !Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'Query directory using NSOperationQueue', Activity ID: 0x0000005300000008 Timestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query directory using NSRunLoop', Activity ID: 0x000000530000000d !Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected !Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
![Page 165: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/165.jpg)
Watching Faults[~] root% ostraceutil -watch -faults Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory !Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'Query directory using NSOperationQueue', Activity ID: 0x0000005300000008 Timestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query directory using NSRunLoop', Activity ID: 0x000000530000000d !Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected !Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
[~] root% ostraceutil -watch -faults
![Page 166: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/166.jpg)
Watching Faults[~] root% ostraceutil -watch -faults Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory !Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'Query directory using NSOperationQueue', Activity ID: 0x0000005300000008 Timestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query directory using NSRunLoop', Activity ID: 0x000000530000000d !Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected !Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory
![Page 167: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/167.jpg)
Watching Faults[~] root% ostraceutil -watch -faults Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory !Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'Query directory using NSOperationQueue', Activity ID: 0x0000005300000008 Timestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query directory using NSRunLoop', Activity ID: 0x000000530000000d !Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected !Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'QueryTimestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query
![Page 168: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/168.jpg)
Watching Faults[~] root% ostraceutil -watch -faults Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory !Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'Query directory using NSOperationQueue', Activity ID: 0x0000005300000008 Timestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query directory using NSRunLoop', Activity ID: 0x000000530000000d !Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected !Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected
![Page 169: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/169.jpg)
Watching Faults[~] root% ostraceutil -watch -faults Process: ================== PID: 557 Image_uuid: 28B91236-BAEA-3979-9DFD-791EBC32E1D6 Image_path: /Demos/Debug/Query Directory.app/Contents/MacOS/Query Directory !Application Breadcrumbs: ================== Timestamp: 996.368669, Breadcrumb ID = 19072, Name = 'Query directory using NSOperationQueue', Activity ID: 0x0000005300000008 Timestamp: 1001.556305, Breadcrumb ID = 19040, Name = 'Query directory using NSRunLoop', Activity ID: 0x000000530000000d !Activity: ================== Activity ID: 0x000000530000000d Activity Name: sendAction: Timestamp: 1001.556262 Reason: none detected !Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
Messages: ================== Timestamp: 1001.589870 RELEASE Activity ID: 0x000000530000000d Trace ID: 0x000001000005d530 Thread: 0x2821 Image UUID: DECA11C7-EB99-3885-947E-42DBD0F9374C Image Path: /usr/libexec/opendirectoryd Offset: 0x21c21 Message: 'request completed, delivered 1 results' ----------------------
![Page 170: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/170.jpg)
Considerations
![Page 171: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/171.jpg)
Privacy
![Page 172: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/172.jpg)
Privacy
Be conscious of privacy when adding trace messages
![Page 173: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/173.jpg)
Privacy
Be conscious of privacy when adding trace messages
Never trace identifying information about a user or device
![Page 174: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/174.jpg)
Propagation FailureTi
me
Program XPCService
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Activity
Breadcrumb
Trace messages
![Page 175: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/175.jpg)
Propagation Failure
diagnosticd
Send mail
button click
Compose mail
Tim
e
Program
menu select
key equivalent
Daemonmenu select
button click
Daemon
menu select
XPCService
Compose mail
Send mail
Activity
Breadcrumb
Trace messages
![Page 176: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/176.jpg)
Support in Diagnostics
OS X Yosemite iOS 8
Crash Reports
Spin Reports
Stackshot
lldb
![Page 177: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/177.jpg)
Why Use Activity Tracing?
![Page 178: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/178.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
![Page 179: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/179.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
Debugger support
![Page 180: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/180.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
Debugger support
Works on both iOS and OS X
![Page 181: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/181.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
Debugger support
Works on both iOS and OS X
Fast and efficient
![Page 182: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/182.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
Debugger support
Works on both iOS and OS X
Fast and efficient
Integrated with GCD, XPC, NSOperationQueue, and Foundation
![Page 183: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/183.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
Debugger support
Works on both iOS and OS X
Fast and efficient
Integrated with GCD, XPC, NSOperationQueue, and Foundation
Captures data that traditional logging mechanisms do not
![Page 184: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/184.jpg)
Why Use Activity Tracing?
Automatically included in diagnostic reports
Debugger support
Works on both iOS and OS X
Fast and efficient
Integrated with GCD, XPC, NSOperationQueue, and Foundation
Captures data that traditional logging mechanisms do not
Trace messages scoped to the action
![Page 185: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/185.jpg)
More Information
Paul Danbold Core OS Technologies Evangelist [email protected]
Apple Developer Forums http://devforums.apple.com
![Page 186: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/186.jpg)
Related Sessions
• Improving Your App with Instruments Marina Tuesday 4:30PM
• Writing Energy Efficient Code, Part 1 Russian Hill Wednesday 10:15AM
• Writing Energy Efficient Code, Part 2 Russian Hill Wednesday 11:30AM
• User Privacy in iOS and OS X Nob Hill Thursday 2:00PM
• Power, Performance and Diagnostics: What’s New in GCD and XPC
Russian Hill Thursday 2:00PM
![Page 187: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/187.jpg)
Labs
• Power and Performance Lab Core OS Lab B Wednesday 2:00PM
• Power and Performance Lab Core OS Lab A Thursday 3:15PM
![Page 188: Fix Bugs Faster Using Activity Tracing - Apple Inc. · 2016-07-08 · Fix Bugs Faster Using Activity Tracing Session 714 Eric Clements Core OS Engineering Core OS. Overview. Overview](https://reader035.vdocuments.net/reader035/viewer/2022081406/5f195a6b3de87920df258fde/html5/thumbnails/188.jpg)