- Instrument: Xcode에 딸린 퍼포먼스 측정, 디버깅 용 툴
- Instrument는 다양한 툴 조합에 대한 preset을 제공
- 종류
- Time Profiler: 지정된 스레드의 콜스택을 정해진 간격으로 기록
- 반응성있는 앱을 위해서는 메인 스레드를 검사해야한다.
- 그 뿐만이 아니라 효율적으로 돌아가는 지도 테스트 해야한다.
- 배터리 효율, 온도 효율 등의 문제 때문에라도 더더욱
- 릴리즈 빌드로 테스트할 것
- 시뮬레이션에서 테스트하는 것은 한계가 있기 때문에 실기기에서 테스트해볼 것
- Points of Interest: 다양한 로깅용 API를 통해서 로그를 수집(Signpost 등)
- SignPost
- Statistical Profile vs Measurement
- 어떻게 해야 로그를 잘 남길 수 있는가? -> Signpost!
- Print보다 간단하고 효과적인 로깅
- 시간 측정 기능이 기본 내장
- mach_absolute_time, CFAbsoluteTimeGetCurrent을 대체할 수 있다.
- Instrument에 의해 추적됨
class ViewController: UIViewController {
static let startupActivities:StaticString = "Startup Activities"
let poiLog = OSLog(subsystem: "com.example.CocoaPictures", category: .pointsOfInterest)
override func viewDidLoad() {
super.viewDidLoad()
os_signpost(.begin, log: self.poiLog, name: ViewController.startupActivities)
// do work to prepare the view
os_signpost(.end, log: self.poiLog, name: ViewController.startupActivities)
}