macOS에서 Instruments 성능 측정 결과 csv로 저장하기
macOS에서 XCode에 포함된 Instruments 도구로 macOS 시스템, macOS용 애플리케이션 또는 iOS용 모바일앱의 자원사용률을 측정하면, 과거에는 csv로 내보내기할 수가 있었는데, 언제부터인가(한 1~2년전) 빼버렸는지 찾을 수가 없었다.
하지만 라인단위로 선택해서 붙여넣기는 여전히 가능해서, “Instruments의 한줄 선택 –> Microsoft Code 텍스트 에디터로 복사”하는 AppleScript를 작성해서 사용하고 있다.
더 멋진 방법이 있는지 모르겠지만 난 이렇게 사용하고 있다. 끝.
(* Commant *) -- https://eastmanreference.com/complete-list-of-applescript-key-codes display dialog "1. Open 'Instruments' and click the 'Active Monitor' area 2. Open the 'Microsoft Code'" -- 복사할 라인수 입력 set x to the text returned of (display dialog "Enter line # to be copied" default answer "10") -- 첫번째 줄로 이동 (option + ↑) tell application "Instruments" to activate tell application "System Events" keystroke (ASCII character 30) using option down end tell -- 새문서 만들기 (ctrl + n) tell application "Visual Studio Code" to activate tell application "System Events" keystroke "n" using command down end tell repeat x times tell application "Instruments" to activate delay 0.2 tell application "System Events" -- ctrl + c keystroke "c" using command down -- 한줄 아래로(↓) keystroke (ASCII character 31) end tell tell application "Visual Studio Code" to activate delay 0.2 tell application "System Events" -- ctrl + v keystroke "v" using command down end tell end repeat quit