TraceUtility
1.0.0
이것은 구식 POC이며 업데이트하지 않을 것입니다. Xcode 12의 새로운 명령 줄 도구 xctrace 사용해보십시오. 릴리스 노트에서 인용했습니다.
악기
새로운 기능
- 이제 xctrace 명령을 사용하여 기존 악기. 트레이스 파일에서 코어 테이블을 내보낼 수 있습니다. 자세한 내용은 Xctrace Man 페이지를 참조하십시오. (12491801)
Xcode 9.4에 번들로 제공되는 Instruments와 함께 작동합니다
블로그 게시물 (중국어)
계측기와 함께 배송 된 미등록 프레임 워크를 사용하여 계측기에서 생성 된 .Trace 문서에서 데이터를 추출하는 방법에 대한 개념 증명.
우리는 이러한 프레임 워크와 연결해야합니다.
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsUtilities.framework/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPlugIn.framework/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsKit.framework/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsAnalysisCore.framework 이 앱에서 사용하는 계측기 템플릿은 /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Packages 의 패키지와 플러그인의 /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns 입니다.
Apple이 PlugIns 에서 Packages 로 마이그레이션하는 것 같습니다. 예를 들어, PlugIns/SamplerPlugin.xrplugin 의 계측기 Time Profile Xcode 8에서 더 이상 사용되지 않으며 Packages/Sampling.instrdst 에 새 버전이 있습니다.
이 프로젝트에는이 예제 루틴이 포함되어 있습니다.
기기에 포함 된 모든 템플릿이 아닙니다. 그러나 콜 트리, 테이블 및 스트림과 같은 여러 공통 구조에서 데이터를 사용하는 방법을 보여주기에 충분합니다.
다음은 샘플 출력입니다.
Trace: /Users/qusic/Downloads/Instruments.trace
Device: Q's (10.3.1) (iPhone9,1 10.3.1 14E304)
Process: Playground (me.qusic.Playground)
Instrument: Time Profiler (com.apple.xray.instrument-type.coresampler2)
Run #2: Run 2
libobjc.A.dylib flushCaches(objc_class*) 25 ms
libobjc.A.dylib cache_erase_nolock 18 ms
libobjc.A.dylib std::__1::__function::__func<void (objc_class*) block_pointer, std::__1::allocator<void (objc_class*) block_pointer>, void (objc_class*)>::operator()(objc_class*&&) 7 ms
dyld __open 4 ms
dyld __mmap 3 ms
libsystem_platform.dylib OSAtomicDequeue 3 ms
libobjc.A.dylib std::__1::__function::__func<foreach_realized_class_and_metaclass(std::__1::function<void (objc_class*)>)::'lambda'(objc_class*), std::__1::allocator<foreach_realized_class_and_metaclass(std::__1::function<void (objc_class*)>)::'lambda'(objc_class*)>, bool (objc_class*)>::operator()(objc_class*&&) 3 ms
dyld getattrlist 2 ms
dyld stat64 2 ms
libobjc.A.dylib realizeClass(objc_class*) 2 ms
libobjc.A.dylib ___ZL11flushCachesP10objc_class_block_invoke_2 2 ms
dyld ImageLoaderMachOCompressed::eachBind(ImageLoader::LinkContext const&, unsigned long (ImageLoaderMachOCompressed::*)(ImageLoader::LinkContext const&, unsigned long, unsigned char, char const*, unsigned char, long, long, char const*, ImageLoaderMachOCompressed::LastLookup*, bool)) 2 ms
dyld ImageLoaderMachOCompressed::interposeAt(ImageLoader::LinkContext const&, unsigned long, unsigned char, char const*, unsigned char, long, long, char const*, ImageLoaderMachOCompressed::LastLookup*, bool) 2 ms
liboainject.dylib 0x10009806c 1 ms
libsystem_c.dylib _thread_stack_pcs 1 ms
libsystem_kernel.dylib __ulock_wake 1 ms
libsystem_platform.dylib _platform_strcmp 1 ms
libsystem_kernel.dylib __open 1 ms
libsystem_kernel.dylib stat 1 ms
libobjc.A.dylib rwlock_tt<false>::read() 1 ms
libsystem_platform.dylib _platform_memmove 1 ms
libsystem_kernel.dylib __ulock_wait 1 ms
libsystem_platform.dylib os_unfair_lock_lock 1 ms
libsystem_kernel.dylib _kernelrpc_mach_port_mod_refs_trap 1 ms
libsystem_platform.dylib _platform_memmove 1 ms
libsystem_pthread.dylib pthread_rwlock_unlock 1 ms
libxpc.dylib xpc_pipe_routine 1 ms
libsystem_c.dylib _thread_stack_pcs 1 ms
libsystem_platform.dylib OSAtomicDequeue 1 ms
libobjc.A.dylib search_method_list(method_list_t const*, objc_selector*) 1 ms
liboainject.dylib 0x10009b064 1 ms
// Truncated for brevity
Instrument: Allocations (com.apple.xray.instrument-type.oa)
Run #2: Run 2
1 2.8 MB
6 1.5 MB
36 768 KB
31 385 KB
33 384 KB
25 214 KB
27 209 KB
26 105 KB
2 2 KB
28 400 bytes
Instrument: Core Animation (com.apple.dt.coreanimation-fps)
Run #2: Run 2
00:00.000.000 0 FPS 34.0% GPU
00:00.001.148 4 FPS 36.0% GPU
00:01.008.767 0 FPS 0.0% GPU
00:02.017.394 4 FPS 0.0% GPU
00:03.307.257 52 FPS 49.0% GPU
00:04.466.874 59 FPS 34.0% GPU
00:05.470.818 60 FPS 35.0% GPU
00:06.481.732 59 FPS 38.0% GPU
00:07.487.501 54 FPS 10.0% GPU
00:08.493.927 26 FPS 54.0% GPU
00:09.724.195 20 FPS 38.0% GPU
00:10.846.081 57 FPS 31.0% GPU
00:11.854.797 24 FPS 8.0% GPU
Instrument: Connections (com.apple.dt.network-connections)
Run #2: Run 2
Wi-Fi tcp4 xxx:xxx<->xxx:xxx, 0 Bytes in, 64 Bytes out
Wi-Fi tcp4 xxx:xxx<->xxx:xxx, 0 Bytes in, 0 Bytes out
Wi-Fi upd4 xxx:xxx<->xxx:xxx, 227 Bytes in, 35 Bytes out
Wi-Fi tcp4 xxx:xxx<->xxx:xxx, 744 Bytes in, 0 Bytes out